Merge from emacs-24; up to 2012-12-22T19:09:52Z!rgm@gnu.org
[bpt/emacs.git] / lisp / progmodes / ada-xref.el
index 0cfdab2..e44b7c1 100644 (file)
@@ -1,6 +1,6 @@
 ;; ada-xref.el --- for lookup and completion in Ada mode
 
-;; Copyright (C) 1994-201 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>
@@ -30,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)
 
@@ -76,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.
@@ -125,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)
@@ -133,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)
 
@@ -169,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."
@@ -1357,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))
@@ -1533,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
@@ -1544,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)
 
@@ -1566,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
@@ -1584,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))
@@ -1783,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