[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/ada-xref.el,v
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/ada-xref.el,v |
Date: |
Tue, 31 Oct 2006 00:57:56 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Juanma Barranquero <lektu> 06/10/31 00:57:56
Index: ada-xref.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/ada-xref.el,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- ada-xref.el 15 Oct 2006 20:41:42 -0000 1.27
+++ ada-xref.el 31 Oct 2006 00:57:56 -0000 1.28
@@ -1,4 +1,4 @@
-;;; ada-xref.el --- for lookup and completion in Ada mode
+;; ada-xref.el --- for lookup and completion in Ada mode
;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
;; 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -6,8 +6,7 @@
;; Author: Markus Heritsch <address@hidden>
;; Rolf Ebert <address@hidden>
;; Emmanuel Briot <address@hidden>
-;; Maintainer: Emmanuel Briot <address@hidden>
-;; Ada Core Technologies's version: Revision: 1.181
+;; Maintainer: Stephen Leake <address@hidden>
;; Keywords: languages ada xref
;; This file is part of GNU Emacs.
@@ -38,6 +37,10 @@
;;; You need Emacs >= 20.2 to run this package
+
+;;; History:
+;;
+
;;; Code:
;; ----- Requirements -----------------------------------------------------
@@ -47,7 +50,7 @@
(require 'find-file)
(require 'ada-mode)
-;; ------ Use variables
+;; ------ User variables
(defcustom ada-xref-other-buffer t
"*If nil, always display the cross-references in the same buffer.
Otherwise create either a new buffer or a new frame."
@@ -59,7 +62,7 @@
:type 'boolean :group 'ada)
(defcustom ada-xref-confirm-compile nil
- "*If non-nil, ask for confirmation before compiling or running the
application."
+ "*Non-nil means ask for confirmation before compiling or running the
application."
:type 'boolean :group 'ada)
(defcustom ada-krunch-args "0"
@@ -105,13 +108,12 @@
(concat "${cross_prefix}gnatmake -u -c ${gnatmake_opt} ${full_current}
-cargs"
" ${comp_opt}")
"*Default command to be used to compile a single file.
-Emacs will add the filename at the end of this command. This is the same
-syntax as in the project file."
+Emacs will substitute the current filename for ${full_current}, or add
+the filename at the end. This is the same syntax as in the project file."
:type 'string :group 'ada)
(defcustom ada-prj-default-debugger "${cross_prefix}gdb"
- "*Default name of the debugger. We recommend either `gdb',
-`gdb --emacs_gdbtk' or `ddd --tty -fullname'."
+ "*Default name of the debugger."
:type 'string :group 'ada)
(defcustom ada-prj-default-make-cmd
@@ -122,9 +124,9 @@
:type 'string :group 'ada)
(defcustom ada-prj-default-project-file ""
- "*Name of the project file to use for every Ada file.
-Emacs will not try to use the standard algorithm to find the project file if
-this string is not empty."
+ "*Name of the current project file.
+Emacs will not try to use the search algorithm to find the project file if
+this string is not empty. It is set whenever a project file is found."
:type '(file :must-match t) :group 'ada)
(defcustom ada-gnatstub-opts "-q -I${src_dir}"
@@ -238,7 +240,7 @@
(defmacro ada-set-on-declaration (ident value) (list 'aset ident 7 value))
(defsubst ada-get-ali-buffer (file)
- "Reads the ali file into a new buffer, and returns this buffer's name"
+ "Read the ali file FILE into a new buffer, and return the buffer's name."
(find-file-noselect (ada-get-ali-file-name file)))
@@ -250,7 +252,7 @@
(defun ada-initialize-runtime-library (cross-prefix)
"Initialize the variables for the runtime library location.
-CROSS-PREFIX is the prefix to use for the gnatls command."
+CROSS-PREFIX is the prefix to use for the `gnatls' command."
(save-excursion
(setq ada-xref-runtime-library-specs-path '()
ada-xref-runtime-library-ali-path '())
@@ -305,9 +307,9 @@
(defun ada-treat-cmd-string (cmd-string)
"Replace meta-sequences like ${...} in CMD-STRING with the appropriate value.
-The project file must have been loaded first.
-As a special case, ${current} is replaced with the name of the currently
-edited file, minus extension but with directory, and ${full_current} is
+Assumes project exists.
+As a special case, ${current} is replaced with the name of the current
+file, minus extension but with directory, and ${full_current} is
replaced by the name including the extension."
(while (string-match "\\(-[^-\$IO]*[IO]\\)?\${\\([^}]+\\)}" cmd-string)
@@ -349,9 +351,8 @@
(set-buffer ada-buffer)
(set 'plist
- ;; Try hard to find a default value for filename, so that the user
- ;; can edit his project file even if the current buffer is not an
- ;; Ada file or not even associated with a file
+ ;; Try hard to find a project file, even if the current
+ ;; buffer is not an Ada file or not associated with a file
(list 'filename (expand-file-name
(cond
(ada-prj-default-project-file
@@ -403,8 +404,7 @@
(defun ada-xref-get-project-field (field)
"Extract the value of FIELD from the current project file.
-The project file must have been loaded first.
-A default value is returned if the file was not found.
+Project variables are substituted.
Note that for src_dir and obj_dir, you should rather use
`ada-xref-get-src-dir-field' or `ada-xref-get-obj-dir-field' which will in
@@ -443,7 +443,6 @@
)
))
-
(defun ada-xref-get-src-dir-field ()
"Return the full value for src_dir, including the default directories.
All the directories are returned as absolute directories."
@@ -529,6 +528,7 @@
"Completion function when reading a file from the minibuffer.
Completion is attempted in all the directories in the source path, as
defined in the project file."
+ ;; FIXME: doc arguments
(let (list
(dirs (ada-xref-get-src-dir-field)))
@@ -547,7 +547,7 @@
;;;###autoload
(defun ada-find-file (filename)
- "Open a file anywhere in the source path.
+ "Open FILENAME, from anywhere in the source path.
Completion is available."
(interactive
(list (completing-read "File: " 'ada-do-file-completion)))
@@ -582,9 +582,10 @@
(goto-char (car pos)))))
(defun ada-convert-file-name (name)
- "Converts from NAME to a name that can be used by the compilation commands.
+ "Convert from NAME to a name that can be used by the compilation commands.
This is overriden on VMS to convert from VMS filenames to Unix filenames."
name)
+;; FIXME: use convert-standard-filename instead
(defun ada-set-default-project-file (name &optional keep-existing)
"Set the file whose name is NAME as the default project file.
@@ -694,8 +695,8 @@
(defun ada-parse-prj-file (prj-file)
- "Reads and parses the PRJ-FILE file if it was found.
-The current buffer should be the ada-file buffer."
+ "Read PRJ-FILE, set it as the active project."
+ ;; FIXME: doc nil, search, etc.
(if prj-file
(let (project src_dir obj_dir make_cmd comp_cmd check_cmd casing
run_cmd debug_pre_cmd debug_post_cmd
@@ -728,6 +729,8 @@
(while (not (eobp))
(if (looking-at "^\\([^=]+\\)=\\(.*\\)")
(cond
+ ;; fields that are lists or paths require special
processing
+ ;; FIXME: strip trailing spaces
((string= (match-string 1) "src_dir")
(add-to-list 'src_dir
(file-name-as-directory (match-string 2))))
@@ -753,6 +756,7 @@
((string= (match-string 1) "debug_post_cmd")
(add-to-list 'debug_post_cmd (match-string 2)))
(t
+ ;; any other field in the file is just copied
(set 'project (plist-put project (intern (match-string 1))
(match-string 2))))))
(forward-line 1))
@@ -937,9 +941,7 @@
;; ----- Identifier Completion --------------------------------------------
(defun ada-complete-identifier (pos)
- "Tries to complete the identifier around POS.
-The feature is only available if the files where compiled without
-the option `-gnatx'."
+ "Try to complete the identifier around POS, using compiler cross-reference
information."
(interactive "d")
(ada-require-project-file)
@@ -990,6 +992,7 @@
(defun ada-goto-body (pos &optional other-frame)
"Display the body of the entity around POS.
+OTHER-FRAME non-nil means display in another frame.
If the entity doesn't have a body, display its declaration.
As a side effect, the buffer for the declaration is also open."
(interactive "d")
@@ -1023,7 +1026,7 @@
;; entity, whose references are not given by GNAT
(if (and (file-exists-p ali-file)
(file-newer-than-file-p ali-file (ada-file-of identlist)))
- (message "No cross-reference found--may be a predefined entity.")
+ (message "No cross-reference found -- may be a predefined entity.")
;; Else, look in every ALI file, except if the user doesn't want that
(if ada-xref-search-with-egrep
@@ -1048,8 +1051,8 @@
command))))
(defun ada-get-absolute-dir-list (dir-list root-dir)
- "Returns the list of absolute directories found in dir-list.
-If a directory is a relative directory, add the value of ROOT-DIR in front."
+ "Return the list of absolute directories found in DIR-LIST.
+If a directory is a relative directory, ROOT-DIR is prepended."
(mapcar (lambda (x) (expand-file-name x root-dir)) dir-list))
(defun ada-set-environment ()
@@ -1134,12 +1137,6 @@
(if (or ada-xref-confirm-compile arg)
(setq cmd (read-from-minibuffer "enter command to compile: " cmd)))
- ;; Insert newlines so as to separate the name of the commands to run
- ;; and the output of the commands. This doesn't work with cmdproxy.exe,
- ;; which gets confused by newline characters.
- (if (not (string-match ".exe" shell-file-name))
- (setq cmd (concat cmd "\n\n")))
-
(compile (ada-quote-cmd cmd))))
(defun ada-check-current (&optional arg)
@@ -1197,9 +1194,9 @@
(defun ada-gdb-application (&optional arg executable-name)
"Start the debugger on the application.
+If ARG is non-nil, ask the user to confirm the command.
EXECUTABLE-NAME, if non-nil, is debugged instead of the file specified in the
-project file.
-If ARG is non-nil, ask the user to confirm the command."
+project file."
(interactive "P")
(let ((buffer (current-buffer))
cmd pre-cmd post-cmd)
@@ -1303,13 +1300,8 @@
(switch-to-buffer buffer)
)))
-
(defun ada-reread-prj-file (&optional filename)
- "Forces Emacs to read either FILENAME or the project file associated
-with the current buffer.
-Otherwise, this file is only read once, and never read again.
-Since the information in the project file is shared between all buffers, this
-automatically modifies the setup for all the Ada buffer that use this file."
+ "Reread either the current project, or FILENAME if non-nil."
(interactive "P")
(if filename
(ada-parse-prj-file filename)
@@ -1375,15 +1367,15 @@
found))
(defun ada-find-ali-file-in-dir (file)
- "Find an .ali file in obj_dir. The current buffer must be the Ada file.
+ "Find the ali file FILE, searching obj_dir for the current project.
Adds build_dir in front of the search path to conform to gnatmake's behavior,
and the standard runtime location at the end."
(ada-find-file-in-dir file (ada-xref-get-obj-dir-field)))
(defun ada-find-src-file-in-dir (file)
- "Find a source file in src_dir. The current buffer must be the Ada file.
-Adds src_dir in front of the search path to conform to gnatmake's behavior,
-and the standard runtime location at the end."
+ "Find the source file FILE, searching src_dir for the current project.
+Adds the standard runtime location at the end of the search path to conform
+to gnatmake's behavior."
(ada-find-file-in-dir file (ada-xref-get-src-dir-field)))
(defun ada-get-ali-file-name (file)
@@ -1522,7 +1514,7 @@
)))
(defun ada-find-file-number-in-ali (file)
- "Returns the file number for FILE in the associated ali file."
+ "Return the file number for FILE in the associated ali file."
(set-buffer (ada-get-ali-buffer file))
(goto-char (point-min))
@@ -1532,7 +1524,7 @@
(count-lines begin (point))))
(defun ada-read-identifier (pos)
- "Returns the identlist around POS and switch to the .ali buffer.
+ "Return the identlist around POS and switch to the .ali buffer.
The returned list represents the entity, and can be manipulated through the
macros `ada-name-of', `ada-line-of', `ada-column-of', `ada-file-of',..."
@@ -1589,8 +1581,8 @@
))
(defun ada-get-all-references (identlist)
- "Completes and returns IDENTLIST with the information extracted
-from the ali file (definition file and places where it is referenced)."
+ "Complete IDENTLIST with definition file and places where it is referenced.
+Information is extracted from the ali file."
(let ((ali-buffer (ada-get-ali-buffer (ada-file-of identlist)))
declaration-found)
@@ -1899,7 +1891,7 @@
This works well when one is using an external librarie and wants
to find the declaration and documentation of the subprograms one is
is using."
-
+;; FIXME: what does this function do?
(let (list
(dirs (ada-xref-get-obj-dir-field))
(regexp (concat "[ *]" (ada-name-of identlist)))
@@ -2043,8 +2035,8 @@
(defun ada-xref-search-nearest (name)
- "Searches for NAME nearest to the position recorded in the Xref file.
-It returns the position of the declaration in the buffer or nil if not found."
+ "Search for NAME nearest to the position recorded in the Xref file.
+Return the position of the declaration in the buffer, or nil if not found."
(let ((orgpos (point))
(newpos nil)
(diff nil))
@@ -2237,22 +2229,9 @@
(ada-xref-update-project-menu)
)
-
;; ----- Add to ada-mode-hook ---------------------------------------------
-;; Use gvd or ddd as the default debugger if it was found
-;; On windows, do not use the --tty switch for GVD, since this is
-;; not supported. Actually, we do not use this on Unix either,
-;; since otherwise there is no console window left in GVD,
-;; and people have to use the Emacs one.
;; This must be done before initializing the Ada menu.
-(if (ada-find-file-in-dir "gvd" exec-path)
- (set 'ada-prj-default-debugger "gvd ")
- (if (ada-find-file-in-dir "gvd.exe" exec-path)
- (set 'ada-prj-default-debugger "gvd ")
- (if (ada-find-file-in-dir "ddd" exec-path)
- (set 'ada-prj-default-debugger "ddd --tty -fullname -toolbar"))))
-
(add-hook 'ada-mode-hook 'ada-xref-initialize)
;; Initializes the cross references to the runtime library