aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2007-08-13 11:10:47 +0000
committerJuanma Barranquero2007-08-13 11:10:47 +0000
commitf020b5c9c57cbefa65a379309662eabef14eec8b (patch)
tree3369aa6757f65961ad9d86ba245485e49807893a
parent340b58d3844ba5e1235aecfd6634e4d47394c40b (diff)
downloademacs-f020b5c9c57cbefa65a379309662eabef14eec8b.tar.gz
emacs-f020b5c9c57cbefa65a379309662eabef14eec8b.zip
(ada-gnatls-args): Fix docstring.
(ada-treat-cmd-string): Improve error message. (ada-do-file-completion): Call `ada-require-project-file', so project variables are set properly. (ada-prj-find-prj-file): Delete Emacs 20.2 support. (ada-gnatfind-buffer-name): New constant. (ada-find-any-references): Use new constant. Set buffer name properly in compilation-start. Toggle read-only properly. (ada-find-in-src-path): Fix spelling error in docstring.
-rw-r--r--lisp/progmodes/ada-xref.el25
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index e8db3d51c2a..c37d11910d4 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -71,7 +71,7 @@ Set to 0, if you don't use crunched filenames. This should be a string."
71 :type 'string :group 'ada) 71 :type 'string :group 'ada)
72 72
73(defcustom ada-gnatls-args '("-v") 73(defcustom ada-gnatls-args '("-v")
74 "*Arguments to pass to `gnatfind' to find location of the runtime. 74 "*Arguments to pass to `gnatls' to find location of the runtime.
75Typical use is to pass `--RTS=soft-floats' on some systems that support it. 75Typical use is to pass `--RTS=soft-floats' on some systems that support it.
76 76
77You can also add `-I-' if you do not want the current directory to be included. 77You can also add `-I-' if you do not want the current directory to be included.
@@ -322,7 +322,6 @@ CROSS-PREFIX is the prefix to use for the `gnatls' command."
322 (reverse ada-xref-runtime-library-ali-path)) 322 (reverse ada-xref-runtime-library-ali-path))
323 )) 323 ))
324 324
325
326(defun ada-treat-cmd-string (cmd-string) 325(defun ada-treat-cmd-string (cmd-string)
327 "Replace meta-sequences like ${...} in CMD-STRING with the appropriate value. 326 "Replace meta-sequences like ${...} in CMD-STRING with the appropriate value.
328Assumes project exists. 327Assumes project exists.
@@ -345,7 +344,7 @@ replaced by the name including the extension."
345 ;; Check if there is an environment variable with the same name 344 ;; Check if there is an environment variable with the same name
346 (if (null value) 345 (if (null value)
347 (if (not (setq value (getenv name))) 346 (if (not (setq value (getenv name)))
348 (message "%s" (concat "No environment variable " name " found")))) 347 (message "%s" (concat "No project or environment variable " name " found"))))
349 348
350 (cond 349 (cond
351 ((null value) 350 ((null value)
@@ -535,6 +534,11 @@ All the directories are returned as absolute directories."
535Completion is attempted in all the directories in the source path, as 534Completion is attempted in all the directories in the source path, as
536defined in the project file." 535defined in the project file."
537 ;; FIXME: doc arguments 536 ;; FIXME: doc arguments
537
538 ;; This function is not itself interactive, but it is called as part
539 ;; of the prompt of interactive functions, so we require a project
540 ;; file.
541 (ada-require-project-file)
538 (let (list 542 (let (list
539 (dirs (ada-xref-get-src-dir-field))) 543 (dirs (ada-xref-get-src-dir-field)))
540 544
@@ -663,9 +667,6 @@ is non-nil, prompt the user to select one. If none are found, return
663 ada-prj-file-extension)) 667 ada-prj-file-extension))
664 (dir (file-name-directory current-file)) 668 (dir (file-name-directory current-file))
665 669
666 ;; on Emacs 20.2, directory-files does not work if
667 ;; parse-sexp-lookup-properties is set
668 (parse-sexp-lookup-properties nil)
669 (prj-files (directory-files 670 (prj-files (directory-files
670 dir t 671 dir t
671 (concat ".*" (regexp-quote 672 (concat ".*" (regexp-quote
@@ -905,6 +906,8 @@ If ARG is t, the contents of the old *gnatfind* buffer is preserved."
905 (interactive "d\nP") 906 (interactive "d\nP")
906 (ada-find-references pos arg t)) 907 (ada-find-references pos arg t))
907 908
909(defconst ada-gnatfind-buffer-name "*gnatfind*")
910
908(defun ada-find-any-references 911(defun ada-find-any-references
909 (entity &optional file line column local-only append) 912 (entity &optional file line column local-only append)
910 "Search for references to any entity whose name is ENTITY. 913 "Search for references to any entity whose name is ENTITY.
@@ -943,23 +946,25 @@ buffer `*gnatfind*', if there is one."
943 (setq command (concat command " -P" ada-prj-default-project-file)) 946 (setq command (concat command " -P" ada-prj-default-project-file))
944 (setq command (concat command " -p" ada-prj-default-project-file)))) 947 (setq command (concat command " -p" ada-prj-default-project-file))))
945 948
946 (if (and append (get-buffer "*gnatfind*")) 949 (if (and append (get-buffer ada-gnatfind-buffer-name))
947 (save-excursion 950 (save-excursion
948 (set-buffer "*gnatfind*") 951 (set-buffer "*gnatfind*")
949 (setq old-contents (buffer-string)))) 952 (setq old-contents (buffer-string))))
950 953
951 (let ((compilation-error "reference")) 954 (let ((compilation-error "reference"))
952 (compilation-start command)) 955 (compilation-start command 'compilation-mode (lambda (mode) ada-gnatfind-buffer-name)))
953 956
954 ;; Hide the "Compilation" menu 957 ;; Hide the "Compilation" menu
955 (save-excursion 958 (save-excursion
956 (set-buffer "*gnatfind*") 959 (set-buffer ada-gnatfind-buffer-name)
957 (local-unset-key [menu-bar compilation-menu]) 960 (local-unset-key [menu-bar compilation-menu])
958 961
959 (if old-contents 962 (if old-contents
960 (progn 963 (progn
961 (goto-char 1) 964 (goto-char 1)
965 (set 'buffer-read-only nil)
962 (insert old-contents) 966 (insert old-contents)
967 (set 'buffer-read-only t)
963 (goto-char (point-max))))) 968 (goto-char (point-max)))))
964 ) 969 )
965 ) 970 )
@@ -1940,7 +1945,7 @@ This function attempts to find the possible declarations for the identifier
1940anywhere in the object path. 1945anywhere in the object path.
1941This command requires the external `egrep' program to be available. 1946This command requires the external `egrep' program to be available.
1942 1947
1943This works well when one is using an external librarie and wants to find 1948This works well when one is using an external library and wants to find
1944the declaration and documentation of the subprograms one is using." 1949the declaration and documentation of the subprograms one is using."
1945;; FIXME: what does this function do? 1950;; FIXME: what does this function do?
1946 (let (list 1951 (let (list