[Emacs-ada-mode] [patch] Surround project file name with double-quotes

Ludovic Brenta ludovic at ludovic-brenta.org
Wed Nov 14 06:35:39 PST 2007


On windows, my project files are in C:\Documents and Settings\... and
the default compile and gnat find commands (C-u C-c C-c and C-r C-r
respectively) fail because the command launched cannot find the project
file.  The fix is to surround the project file name with double-quote
characters, e.g. gnatmake -P"C:\Documents and Settings\...\f.gpr".
The patch below does this unconditionally because the double-quote
characters are harmless even if they are not necessary.

another fix in this patch is the use of the variable ada-gnat-cmd
instead of hardcoded "gnat" in "gnat find".  This is handy when you
don't have a native GNAT installed but only a cross gnat, e.g.
powerpc-wrs-vxworks-gnat.

-- 
Ludovic Brenta.

#
# old_revision [808c6ed5aa02d3f36a67a8add3577285ca3a003d]
#
# patch "ada-xref.el"
#  from [162a3f634de204a7934fe0ef444869e0b40a90dd]
#    to [d5c9a4d5185f89a3fde5ac61083b7e661e7df13e]
#
============================================================
--- ada-xref.el 162a3f634de204a7934fe0ef444869e0b40a90dd
+++ ada-xref.el d5c9a4d5185f89a3fde5ac61083b7e661e7df13e
@@ -451,7 +451,7 @@ addition return the default paths."
      ((eq field 'gnatmake_opt)
       (let ((gpr-file (plist-get project-plist 'gpr_file)))
        (if (not (string= gpr-file ""))
-           (setq value (concat "-P" gpr-file " " value)))))
+           (setq value (concat "-P\"" gpr-file "\" " value)))))

      ;; FIXME: check for src_dir, obj_dir here, rather than requiring user to do it
      (t
@@ -991,7 +991,7 @@ buffer `*gnatfind*', if there is one."
            entity))
         (switches (ada-xref-get-project-field 'gnatfind_opt))
         ;; FIXME: use gpr_file
-        (command (concat "gnat find " switches " "
+        (command (concat ada-gnat-cmd " find " switches " "
                          quote-entity
                          (if file (concat ":" (file-name-nondirectory file)))
                          (if line (concat ":" line))
@@ -1005,8 +1005,8 @@ buffer `*gnatfind*', if there is one."
             (not (string= ada-prj-default-project-file "")))
        (if (string-equal (file-name-extension ada-prj-default-project-file)
                          "gpr")
-           (setq command (concat command " -P" ada-prj-default-project-file))
-         (setq command (concat command " -p" ada-prj-default-project-file))))
+           (setq command (concat command " -P\"" ada-prj-default-project-file "\""))
+         (setq command (concat command " -p\"" ada-prj-default-project-file "\""))))

     (if (and append (get-buffer "*gnatfind*"))
        (save-excursion



More information about the Emacs-ada-mode mailing list