]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/ada-xref.el
Merge from emacs-24; up to 2013-01-01T11:02:14Z!rudalics@gmx.at
[gnu-emacs] / lisp / progmodes / ada-xref.el
index 190029f606fe83551ed5d9e934bc68fcebb9f4cc..e44b7c191bf9642ccca08bc43f9fa874619a6282 100644 (file)
@@ -1,8 +1,6 @@
 ;; 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, 2007, 2008, 2009, 2010, 2011
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1994-2013 Free Software Foundation, Inc.
 
 ;; Author: Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de>
 ;;      Rolf Ebert <ebert@inf.enst.fr>
@@ -32,7 +30,7 @@
 ;;; for lookup and completion in Ada mode.
 ;;;
 ;;; If a file *.`adp' exists in the ada-file directory, then it is
-;;; read for configuration informations.  It is read only the first
+;;; 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
 
 ;; ------ User variables
 (defcustom ada-xref-other-buffer t
-  "*If nil, always display the cross-references in the same buffer.
+  "If nil, always display the cross-references in the same buffer.
 Otherwise create either a new buffer or a new frame."
   :type 'boolean :group 'ada)
 
 (defcustom ada-xref-create-ali nil
-  "*If non-nil, run gcc whenever the cross-references are not up-to-date.
+  "If non-nil, run gcc whenever the cross-references are not up-to-date.
 If nil, the cross-reference mode never runs gcc."
   :type 'boolean :group 'ada)
 
 (defcustom ada-xref-confirm-compile nil
-  "*If non-nil, ask for confirmation before compiling or running the application."
+  "If non-nil, ask for confirmation before compiling or running the application."
   :type 'boolean :group 'ada)
 
 (defcustom ada-krunch-args "0"
-  "*Maximum number of characters for filenames created by `gnatkr'.
+  "Maximum number of characters for filenames created by `gnatkr'.
 Set to 0, if you don't use crunched filenames.  This should be a string."
   :type 'string :group 'ada)
 
@@ -78,7 +76,7 @@ is faster, available from Ada mode web site."
   :type 'string :group 'ada)
 
 (defcustom ada-gnatls-args '("-v")
-  "*Arguments to pass to `gnatls' to find location of the runtime.
+  "Arguments to pass to `gnatls' to find location of the runtime.
 Typical use is to pass `--RTS=soft-floats' on some systems that support it.
 
 You can also add `-I-' if you do not want the current directory to be included.
@@ -127,7 +125,7 @@ The command `gnatfind' is used every time you choose the menu
 (defcustom ada-prj-default-check-cmd
   (concat "${cross_prefix}gnatmake -u -c -gnatc ${gnatmake_opt} ${full_current}"
          " -cargs ${comp_opt}")
-  "*Default command to be used to compile a single file.
+  "Default command to be used to compile a single 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)
@@ -135,35 +133,35 @@ the filename at the end.  This is the same syntax as in the project file."
 (defcustom ada-prj-default-comp-cmd
   (concat "${cross_prefix}gnatmake -u -c ${gnatmake_opt} ${full_current} -cargs"
          " ${comp_opt}")
-  "*Default command to be used to compile a single file.
+  "Default command to be used to compile a single 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."
+  "Default name of the debugger."
   :type 'string :group 'ada)
 
 (defcustom ada-prj-default-make-cmd
   (concat "${cross_prefix}gnatmake -o ${main} ${main} ${gnatmake_opt} "
          "-cargs ${comp_opt} -bargs ${bind_opt} -largs ${link_opt}")
-  "*Default command to be used to compile the application.
+  "Default command to be used to compile the application.
 This is the same syntax as in the project file."
   :type 'string :group 'ada)
 
 (defcustom ada-prj-default-project-file ""
-  "*Name of the current project file.
+  "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}"
-  "*Options to pass to `gnatsub' to generate the body of a package.
+  "Options to pass to `gnatsub' to generate the body of a package.
 This has the same syntax as in the project file (with variable substitution)."
   :type 'string :group 'ada)
 
 (defcustom ada-always-ask-project nil
-  "*If nil, use default values when no project file was found.
+  "If nil, use default values when no project file was found.
 Otherwise, ask the user for the name of the project file to use."
   :type 'boolean :group 'ada)
 
@@ -171,12 +169,12 @@ Otherwise, ask the user for the name of the project file to use."
   "True if we are running on Windows.")
 
 (defcustom ada-tight-gvd-integration nil
-  "*If non-nil, a new Emacs frame will be swallowed in GVD when debugging.
+  "If non-nil, a new Emacs frame will be swallowed in GVD when debugging.
 If GVD is not the debugger used, nothing happens."
   :type 'boolean :group 'ada)
 
 (defcustom ada-xref-search-with-egrep t
-  "*If non-nil, use egrep to find the possible declarations for an entity.
+  "If non-nil, use egrep to find the possible declarations for an entity.
 This alternate method is used when the exact location was not found in the
 information provided by GNAT.  However, it might be expensive if you have a lot
 of sources, since it will search in all the files in your project."
@@ -1045,7 +1043,7 @@ existing buffer `*gnatfind*', if there is one."
          (setq old-contents (buffer-string))))
 
     (let ((compilation-error "reference"))
-      (compilation-start command 'compilation-mode (lambda (mode) ada-gnatfind-buffer-name)))
+      (compilation-start command 'compilation-mode (lambda (_mode) ada-gnatfind-buffer-name)))
 
     ;;  Hide the "Compilation" menu
     (with-current-buffer ada-gnatfind-buffer-name
@@ -1165,7 +1163,8 @@ If OTHER-FRAME is non-nil, display the cross-reference in another frame."
 
 (defun ada-goto-declaration-other-frame (pos)
   "Display the declaration of the identifier around POS.
-The declation is shown in another frame if `ada-xref-other-buffer' is non-nil."
+The declaration is shown in another frame if `ada-xref-other-buffer' is
+non-nil."
   (interactive "d")
   (ada-goto-declaration pos t))
 
@@ -1358,7 +1357,7 @@ project file."
                          (or executable-name
                              (file-name-sans-extension (buffer-file-name))))))
 
-    ;;  For gvd, add an extra switch so that the Emacs window is completly
+    ;;  For gvd, add an extra switch so that the Emacs window is completely
     ;;  swallowed inside the Gvd one
     (if (and ada-tight-gvd-integration
             (string-match "^[^ \t]*gvd" cmd))
@@ -1386,7 +1385,7 @@ project file."
 
       ;;  Do not add -fullname, since we can have a 'rsh' command in front.
       ;;  FIXME: This is evil but luckily a nop under Emacs-21.3.50 !  -stef
-      (fset 'gud-gdb-massage-args (lambda (file args) args))
+      (fset 'gud-gdb-massage-args (lambda (_file args) args))
 
       (set 'pre-cmd  (mapconcat 'identity pre-cmd  ada-command-separator))
       (if (not (equal pre-cmd ""))
@@ -1440,7 +1439,7 @@ project file."
       ;;  is going to have some relevant information.
       (if (or (not (string-match "gvd" (comint-arguments cmd 0 0)))
              (string-match "--tty" cmd))
-         (split-window-vertically))
+         (split-window-below))
       (switch-to-buffer buffer)
       )))
 
@@ -1534,7 +1533,7 @@ the project file."
   ;;      .ali file for a spec file.  If we are, go to step 3.
   ;;   3- If the file is not found or step 2 failed:
   ;;      find the name of the "other file", ie the body, and look
-  ;;      for its associated .ali file by subtituing the extension
+  ;;      for its associated .ali file by substituting the extension
   ;;
   ;; We must also handle the case of separate packages and subprograms:
   ;;   4- If no ali file was found, we try to modify the file name by removing
@@ -1545,9 +1544,7 @@ the project file."
   ;;      also a separate.
 
   (with-current-buffer (get-file-buffer file)
-    (let ((short-ali-file-name
-          (concat (file-name-sans-extension (file-name-nondirectory file))
-                  ".ali"))
+    (let ((short-ali-file-name (concat (file-name-base file) ".ali"))
          ali-file-name
          is-spec)
 
@@ -1567,10 +1564,7 @@ the project file."
       (if is-spec
          (set 'ali-file-name
               (ada-find-ali-file-in-dir
-               (concat (file-name-sans-extension
-                        (file-name-nondirectory
-                         (ada-other-file-name)))
-                       ".ali"))))
+               (concat (file-name-base (ada-other-file-name)) ".ali"))))
 
 
       (setq ali-file-name
@@ -1585,15 +1579,12 @@ the project file."
                ;;  file_s.ada and file_b.ada), try to go to the other file
                ;;  and look for its ali file
                (ada-find-ali-file-in-dir
-                (concat (file-name-sans-extension
-                         (file-name-nondirectory (ada-other-file-name)))
-                        ".ali"))
+                (concat (file-name-base (ada-other-file-name)) ".ali"))
 
 
                ;;  If we still don't have an ali file, try to get the one
                ;;  from the parent unit, in case we have a separate entity.
-               (let ((parent-name (file-name-sans-extension
-                                   (file-name-nondirectory file))))
+               (let ((parent-name (file-name-base file)))
 
                  (while (and (not ali-file-name)
                              (string-match "^\\(.*\\)[.-][^.-]*" parent-name))
@@ -1749,7 +1740,7 @@ Information is extracted from the ali file."
 
     (unless declaration-found
 
-      ;; Since we alread know the number of the file, search for a direct
+      ;; Since we already know the number of the file, search for a direct
       ;; reference to it
       (goto-char (point-min))
       (set 'declaration-found t)
@@ -1784,7 +1775,7 @@ Information is extracted from the ali file."
            )
          )
 
-      ;; Last check to be completly sure we have found the correct line (the
+      ;; Last check to be completely sure we have found the correct line (the
       ;; ali might not be up to date for instance)
       (if declaration-found
          (progn