summaryrefslogtreecommitdiff
path: root/lisp/progmodes/ada-xref.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2017-01-04 00:40:45 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2017-01-04 00:40:45 -0500
commit2ec41c415f39990561cc9da4c9bad0b69bfad489 (patch)
tree01a5234df9caa1e9db39d76bf31ba8a3a622298c /lisp/progmodes/ada-xref.el
parentf49f8c1454e19123572a071bf582271c70d28f01 (diff)
downloademacs-2ec41c415f39990561cc9da4c9bad0b69bfad489.tar.gz
Avoid add-to-list on local variables
* lisp/gnus/nnir.el: Use lexical-binding and cl-lib. (nnir-retrieve-headers): Use pcase. (nnir-search-thread): Avoid add-to-list on local variables. * lisp/gnus/smime.el: Use lexical-binding and cl-lib. (smime-verify-region): Avoid add-to-list on local variables. * lisp/mail/undigest.el: Use lexical-binding and cl-lib. (rmail-digest-parse-mime, rmail-digest-rfc1153) (rmail-digest-parse-rfc934): Avoid add-to-list on local variable. * lisp/net/ldap.el (ldap-search): Move init into declaration. * lisp/net/newst-backend.el (newsticker--cache-add): Avoid add-to-list on local variables; Simplify code with `assq'. * lisp/net/zeroconf.el: Use lexical-binding and cl-lib. (dbus-debug): Remove declaration, unused. (zeroconf-service-add-hook, zeroconf-service-remove-hook) (zeroconf-service-browser-handler, zeroconf-publish-service): Avoid add-to-list and *-hook on local variables. * lisp/org/org-archive.el (org-all-archive-files): * lisp/org/org-agenda.el (org-agenda-get-restriction-and-command): Avoid add-to-list on local variables. * lisp/org/ox-publish.el (org-publish--run-functions): New function. (org-publish-projects): Use it to avoid run-hooks on a local variable. (org-publish-cache-file-needs-publishing): Avoid add-to-list on local variables. * lisp/progmodes/ada-prj.el: Use setq instead of (set '...). (ada-prj-load-from-file): Avoid add-to-list on local variables. * lisp/progmodes/ada-xref.el (ada-initialize-runtime-library): Simplify. (ada-gnat-parse-gpr, ada-parse-prj-file-1) (ada-xref-find-in-modified-ali): Avoid add-to-list on local variables. * lisp/progmodes/idlw-shell.el (idlwave-shell-update-bp-overlays): Avoid add-to-list on local variables.
Diffstat (limited to 'lisp/progmodes/ada-xref.el')
-rw-r--r--lisp/progmodes/ada-xref.el92
1 files changed, 44 insertions, 48 deletions
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 4da81da7854..4e196505b6c 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -25,19 +25,14 @@
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
-;;; This Package provides a set of functions to use the output of the
-;;; cross reference capabilities of the GNAT Ada compiler
-;;; for lookup and completion in Ada mode.
-;;;
-;;; If a file *.`adp' exists in the ada-file directory, then it is
-;;; read for configuration information. It is read only the first
-;;; time a cross-reference is asked for, and is not read later.
-;;; You need Emacs >= 20.2 to run this package
-
-
-;;; History:
+;; This Package provides a set of functions to use the output of the
+;; cross reference capabilities of the GNAT Ada compiler
+;; for lookup and completion in Ada mode.
;;
+;; If a file *.`adp' exists in the ada-file directory, then it is
+;; read for configuration information. It is read only the first
+;; time a cross-reference is asked for, and is not read later.
;;; Code:
@@ -47,6 +42,7 @@
(require 'comint)
(require 'find-file)
(require 'ada-mode)
+(eval-when-compile (require 'cl-lib))
;; ------ User variables
(defcustom ada-xref-other-buffer t
@@ -318,9 +314,9 @@ CROSS-PREFIX is the prefix to use for the `gnatls' command."
(forward-line 1)
(while (not (looking-at "^$"))
(back-to-indentation)
- (if (looking-at "<Current_Directory>")
- (add-to-list 'ada-xref-runtime-library-specs-path ".")
- (add-to-list 'ada-xref-runtime-library-specs-path
+ (add-to-list 'ada-xref-runtime-library-specs-path
+ (if (looking-at "<Current_Directory>")
+ "."
(buffer-substring-no-properties
(point)
(point-at-eol))))
@@ -332,9 +328,9 @@ CROSS-PREFIX is the prefix to use for the `gnatls' command."
(forward-line 1)
(while (not (looking-at "^$"))
(back-to-indentation)
- (if (looking-at "<Current_Directory>")
- (add-to-list 'ada-xref-runtime-library-ali-path ".")
- (add-to-list 'ada-xref-runtime-library-ali-path
+ (add-to-list 'ada-xref-runtime-library-ali-path
+ (if (looking-at "<Current_Directory>")
+ "."
(buffer-substring-no-properties
(point)
(point-at-eol))))
@@ -380,12 +376,12 @@ Assumes environment variable ADA_PROJECT_PATH is set properly."
(forward-line 1) ; first directory in list
(while (not (looking-at "^$")) ; terminate on blank line
(back-to-indentation) ; skip whitespace
- (add-to-list 'src-dir
- (if (looking-at "<Current_Directory>")
- default-directory
- (expand-file-name
- (buffer-substring-no-properties
- (point) (line-end-position)))))
+ (cl-pushnew (if (looking-at "<Current_Directory>")
+ default-directory
+ (expand-file-name
+ (buffer-substring-no-properties
+ (point) (line-end-position))))
+ src-dir :test #'equal)
(forward-line 1))
;; Object path
@@ -394,12 +390,12 @@ Assumes environment variable ADA_PROJECT_PATH is set properly."
(forward-line 1)
(while (not (looking-at "^$"))
(back-to-indentation)
- (add-to-list 'obj-dir
- (if (looking-at "<Current_Directory>")
- default-directory
- (expand-file-name
- (buffer-substring-no-properties
- (point) (line-end-position)))))
+ (cl-pushnew (if (looking-at "<Current_Directory>")
+ default-directory
+ (expand-file-name
+ (buffer-substring-no-properties
+ (point) (line-end-position))))
+ obj-dir :test #'equal)
(forward-line 1))
;; Set properties
@@ -831,9 +827,9 @@ Return new value of PROJECT."
;; FIXME: strip trailing spaces
;; variable name alphabetical order
((string= (match-string 1) "ada_project_path")
- (add-to-list 'ada_project_path
- (expand-file-name
- (substitute-in-file-name (match-string 2)))))
+ (cl-pushnew (expand-file-name
+ (substitute-in-file-name (match-string 2)))
+ ada_project_path :test #'equal))
((string= (match-string 1) "build_dir")
(setq project
@@ -841,40 +837,40 @@ Return new value of PROJECT."
(file-name-as-directory (match-string 2)))))
((string= (match-string 1) "casing")
- (add-to-list 'casing
- (expand-file-name (substitute-in-file-name (match-string 2)))))
+ (cl-pushnew (expand-file-name (substitute-in-file-name (match-string 2)))
+ casing :test #'equal))
((string= (match-string 1) "check_cmd")
- (add-to-list 'check_cmd (match-string 2)))
+ (cl-pushnew (match-string 2) check_cmd :test #'equal))
((string= (match-string 1) "comp_cmd")
- (add-to-list 'comp_cmd (match-string 2)))
+ (cl-pushnew (match-string 2) comp_cmd :test #'equal))
((string= (match-string 1) "debug_post_cmd")
- (add-to-list 'debug_post_cmd (match-string 2)))
+ (cl-pushnew (match-string 2) debug_post_cmd :test #'equal))
((string= (match-string 1) "debug_pre_cmd")
- (add-to-list 'debug_pre_cmd (match-string 2)))
+ (cl-pushnew (match-string 2) debug_pre_cmd :test #'equal))
((string= (match-string 1) "gpr_file")
;; expand now; path is relative to Emacs project file
(setq gpr_file (expand-file-name (match-string 2))))
((string= (match-string 1) "make_cmd")
- (add-to-list 'make_cmd (match-string 2)))
+ (cl-pushnew (match-string 2) make_cmd :test #'equal))
((string= (match-string 1) "obj_dir")
- (add-to-list 'obj_dir
- (file-name-as-directory
- (expand-file-name (match-string 2)))))
+ (cl-pushnew (file-name-as-directory
+ (expand-file-name (match-string 2)))
+ obj_dir :test #'equal))
((string= (match-string 1) "run_cmd")
- (add-to-list 'run_cmd (match-string 2)))
+ (cl-pushnew (match-string 2) run_cmd :test #'equal))
((string= (match-string 1) "src_dir")
- (add-to-list 'src_dir
- (file-name-as-directory
- (expand-file-name (match-string 2)))))
+ (cl-pushnew (file-name-as-directory
+ (expand-file-name (match-string 2)))
+ src_dir :test #'equal))
(t
;; any other field in the file is just copied
@@ -1866,8 +1862,8 @@ This function is disabled for operators, and only works for identifiers."
)
;; construct a list with the file names and the positions within
(if (re-search-backward "^X [0-9]+ \\([a-zA-Z0-9._-]+\\)" nil t)
- (add-to-list
- 'declist (list line-ali (match-string 1) line-ada col-ada))
+ (cl-pushnew (list line-ali (match-string 1) line-ada col-ada)
+ declist :test #'equal)
)
)
)