(< 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)
(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)
((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)
(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)
(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))
)