]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/ada-mode/ada-gnat-compile.el
Add *.info and dir to debbugs
[gnu-emacs-elpa] / packages / ada-mode / ada-gnat-compile.el
old mode 100755 (executable)
new mode 100644 (file)
index 8036f80..510bef1
@@ -222,25 +222,21 @@ Prompt user if more than one."
                                (< pos limit))))
                   (when (not done)
                     (let* ((item (get-text-property pos 'ada-secondary-error))
-                           (unit-file (nth 0 item)))
-                      (add-to-list 'choices (ada-ada-name-from-file-name unit-file))
+                           (unit-file (nth 0 item))
+                            (choice (ada-ada-name-from-file-name unit-file)))
+                       (unless (member choice choices) (push choice choices))
                       (goto-char (1+ pos))
                       (goto-char (1+ (next-single-property-change (point) 'ada-secondary-error nil limit)))
                       (when (eolp) (forward-line 1))
                       ))
                   )));; unless while let
 
-            (cond
-             ((= 0 (length choices))
-              (setq unit-name nil))
-
-             ((= 1 (length choices))
-              (setq unit-name (car choices)))
-
-             (t ;; multiple choices
-              (setq unit-name
-                    (completing-read "package name: " choices)))
-             );; cond
+            (setq unit-name
+                  (cond
+                   ((= 0 (length choices)) nil)
+                   ((= 1 (length choices)) (car choices))
+                   (t ;; multiple choices
+                    (completing-read "package name: " choices))))
 
             (when unit-name
               (pop-to-buffer source-buffer)
@@ -330,6 +326,19 @@ Prompt user if more than one."
             (insert expected-name))
           t)
 
+         ((looking-at (concat "\"end loop " ada-name-regexp ";\" expected"))
+          (let ((expected-name (match-string 1)))
+            (pop-to-buffer source-buffer)
+            (if (looking-at (concat "end loop " ada-name-regexp ";"))
+                (progn
+                  (goto-char (match-end 1))   ; just before ';'
+                  (delete-region (match-beginning 1) (match-end 1)))
+              ;; else we have just 'end loop;'
+              (forward-word 2)
+              (insert " "))
+            (insert expected-name))
+          t)
+
          ((looking-at "expected an access type")
           (progn
             (set-buffer source-buffer)
@@ -490,7 +499,8 @@ Prompt user if more than one."
          ((looking-at (concat "warning: variable " ada-gnat-quoted-name-regexp " is assigned but never read"))
           (let ((param (match-string 1)))
             (pop-to-buffer source-buffer)
-            (ada-goto-end)
+            (ada-goto-end) ;; leaves point before semicolon
+            (forward-char 1)
             (newline-and-indent)
             (insert "pragma Unreferenced (" param ");"))
           t)
@@ -571,7 +581,12 @@ Prompt user if more than one."
 
 (defun ada-gnat-compile-select-prj ()
   (setq ada-fix-error-hook 'ada-gnat-fix-error-hook)
+  (setq ada-prj-show-path 'gnat-prj-show-path)
   (add-to-list 'completion-ignored-extensions ".ali") ;; gnat library files
+  (add-hook 'ada-syntax-propertize-hook 'ada-gnat-syntax-propertize)
+
+  ;; find error locations in .gpr files
+  (setq compilation-search-path (append compilation-search-path (ada-prj-get 'prj_dir)))
 
   (add-hook 'compilation-filter-hook 'ada-gnat-compilation-filter)
 
@@ -583,6 +598,10 @@ Prompt user if more than one."
 (defun ada-gnat-compile-deselect-prj ()
   (setq ada-fix-error-hook nil)
   (setq completion-ignored-extensions (delete ".ali" completion-ignored-extensions))
+  (setq ada-syntax-propertize-hook (delq 'ada-gnat-syntax-propertize ada-syntax-propertize-hook))
+
+  ;; don't need to delete from compilation-search-path; completely rewritten in ada-select-prj-file
+
   (setq compilation-filter-hook (delete 'ada-gnat-compilation-filter compilation-filter-hook))
   (setq compilation-error-regexp-alist (delete 'gnat compilation-error-regexp-alist))
   )