[Emacs-ada-mode] [Emacs][ada-mode] ada-xref.el -- missing gnatls in PATH

Stephen Leake stephen_leake at stephe-leake.org
Thu Nov 15 17:13:47 PST 2007


Pierre-Louis Escouflaire <pierre-louis.escouflaire at eurocontrol.int> writes:

> We found a relatively drastic problem related to the 'ada-xref.el' 
> script file that appears when you do NOT have 'gnatls' in your PATH.
>
> <snip>
>
> Another solution (maybe wiser) would be to change `ada-find-executable' 
> so that it raises an error when the executable has not been found. The 
> one using it should then protect it using a `condition-case'.

Yes, this is right way (you'd think people using Ada would not ignore
errors!). Try this:

(defun ada-find-executable (exec-name)
  "Find the full path to the executable file EXEC-NAME.
If not found, throw an error.
On Windows systems, this will properly handle .exe extension as well"
  (let ((result (or (ada-find-file-in-dir exec-name exec-path)
                    (ada-find-file-in-dir (concat exec-name ".exe") exec-path))))
    (if result
        result
      (error "'%s' not found in path" exec-name))))

ada-find-executable is only used in ada-initialize-runtime-library, so
this won't break anything else.

I don't think there's any point in attempting to handle the error in
ada-initialize-runtime-library; if gnatls isn't found, nothing else
will work either, because gnat won't be found.

Too late for 3.9; this will be in 4.00 (sometime).

-- 
-- Stephe



More information about the Emacs-ada-mode mailing list