]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/ada-mode/gpr-mode.el
Merge commit 'f062d5a55496e22cf89f2ef9778a24a840a5a68e' from context-coloring
[gnu-emacs-elpa] / packages / ada-mode / gpr-mode.el
old mode 100755 (executable)
new mode 100644 (file)
index f11e417..798964a
@@ -36,6 +36,7 @@
 
 ;; we reuse several ada-mode functions
 (require 'ada-mode)
+(require 'cl-lib)
 
 (defvar gpr-mode-map
   (let ((map (make-sparse-keymap)))
@@ -77,8 +78,9 @@
     ["------"        nil nil]
     ["Find and select project ..." ada-build-prompt-select-prj-file t]
     ["Select project ..."          ada-prj-select                   t]
-    ["Set as current project"      gpr-set-as-project               t]
+    ["Parse and select current file" gpr-set-as-project             t]
     ["Show current project"        ada-prj-show                     t]
+    ["Show project search path"    ada-prj-show-path                t]
     ["Next compilation error"      next-error                       t]
     ["Show secondary error"        ada-show-secondary-error         t]
     ["Show last parse error"       gpr-show-parse-error             t]
@@ -208,6 +210,13 @@ of the package or project point is in or just after, or nil.")
 (defun gpr-set-as-project (&optional file)
   "Set FILE (default current buffer file) as Emacs project file."
   (interactive)
+  (save-some-buffers t)
+  ;; Kill sessions to catch changed env vars
+  ;; FIXME: need dispatching kill single session
+  (cl-ecase ada-xref-tool
+    (gnat_xref nil)
+    (gpr_query (gpr-query-kill-all-sessions))
+    )
   (ada-parse-prj-file (or file (buffer-file-name)))
   (ada-select-prj-file (or file (buffer-file-name))))
 
@@ -237,22 +246,11 @@ of the package or project point is in or just after, or nil.")
         ((?\_ . "w"))))
 
   (gpr-set-ff-special-constructs)
-  (setq ff-search-directories 'ada-project-search-path)
+  (setq ff-search-directories 'compilation-search-path);; includes project search path
 
   (set (make-local-variable 'add-log-current-defun-function)
        'gpr-add-log-current-function)
 
-  ;; used by autofill to break a comment line and continue it on
-  ;; another line. The reason we need this one is that the default
-  ;; behavior does not work correctly with the definition of
-  ;; paragraph-start above when the comment is right after a
-  ;; multi-line subprogram declaration (the comments are aligned under
-  ;; the latest parameter, not under the declaration start).
-  ;; FIXME: need test - should be in gpr-wisi? why doesn't ada-mode do this?
-  (set (make-local-variable 'comment-line-break-function)
-       (lambda (&optional soft) (let ((fill-prefix nil))
-                                 (indent-new-comment-line soft))))
-
   (run-hooks 'gpr-mode-hook)
 
   )