diff options
-rw-r--r-- | ide/coq.ml | 12 | ||||
-rw-r--r-- | ide/coq.mli | 1 | ||||
-rw-r--r-- | ide/coq.png | bin | 9316 -> 9101 bytes | |||
-rw-r--r-- | ide/coqide.ml | 17 |
4 files changed, 23 insertions, 7 deletions
diff --git a/ide/coq.ml b/ide/coq.ml index 408054ee1..b166871c4 100644 --- a/ide/coq.ml +++ b/ide/coq.ml @@ -76,6 +76,18 @@ let is_in_coq_lib dir = Coq_config.theories_dirs with _ -> prerr_endline " No(because of a global exn)";false +let is_in_coq_path f = + try + let base = Filename.chop_extension (Filename.basename f) in + let _ = Library.locate_qualified_library + (Libnames.make_qualid Names.empty_dirpath + (Names.id_of_string base)) in + prerr_endline (f ^ "is in coq path"); + true + with _ -> + prerr_endline (f ^ "is NOT in coq path"); + false + let is_in_proof_mode () = try ignore (get_pftreestate ()); true with _ -> false diff --git a/ide/coq.mli b/ide/coq.mli index 641bcf201..a420a1f4f 100644 --- a/ide/coq.mli +++ b/ide/coq.mli @@ -48,6 +48,7 @@ val hyp_menu : hyp -> (string * string) list val concl_menu : concl -> (string * string) list val is_in_coq_lib : string -> bool +val is_in_coq_path : string -> bool val make_cases : string -> string list list diff --git a/ide/coq.png b/ide/coq.png Binary files differindex f9e14aa39..2e5bdcd65 100644 --- a/ide/coq.png +++ b/ide/coq.png diff --git a/ide/coqide.ml b/ide/coqide.ml index 7007d0509..c3f2e48ef 100644 --- a/ide/coqide.ml +++ b/ide/coqide.ml @@ -1409,13 +1409,16 @@ Please restart and report NOW."; (out_some ((Vector.get input_views index).analyzed_view)) #filename with - | None -> initial_cwd - | Some f -> Filename.dirname f - ) - in - if not (is_in_coq_lib dir) then - ignore (Coq.interp (Printf.sprintf "Add LoadPath \"%s\". " dir)); - Sys.chdir dir + | None -> () + | Some f -> + if not (is_in_coq_path f) then + begin + let dir = Filename.dirname f in + ignore (Coq.interp + (Printf.sprintf "Add LoadPath \"%s\". " dir)) + end) + in () + method electric_handler = |