Ludovic Brenta <[email protected]> writes:
> Stephen Leake writes:
>> Ludovic Brenta writes:
>>
>>> It occurred to me that ada-mode 5 replaces ada-mode.el but not
>>> ada-xref.el, so that the function ada-find-file, defined in
>>> ada-xref.el from ada-mode 4, is still visible, but obviously doesn't
>>> work because the ada-mode 4 project file is missing.
>>
>> Actually, the problem is the auto-loads in the installed emacs, not
>> the presence of the file in load-path.
>>
>> You are the first to notice this; exactly why is it a problem?
>>
>> Do you invoke ada-find-file directly for some reason? or load/require
>> ada-xref?
>
> Not me; one of our guinea pigs. He is used to start emacs and then M-x
> ada-find immediately. With ada-mode 4 this works through a kludge in
> our ~/.emacs that requires 'ada-xref and creates an emacs Ada project in
> memory from $ADA_INCLUDE_PATH.
If your ~/.emacs is centrally managed, then that (require 'ada-xref) is
now gone?
Otherwise, I think the way to handle (require 'ada-xref) etc is to
provide a dummy file ada-xref.el in ada-mode 5.x that just issues an
"obsolete" message.
Or maybe also requires ada-mode?
That will be found first load-path, so the 4.01 files are hidden.
I propose to define ada-find-file in 5.x as:
(defun ada-find-file ()
(interactive)
;; we assume compliation-search-path is set, either by an
;; ada-mode project, or by some other means.
(let ((dirs compilation-search-path)
list
filename)
;; build completion list of all file names in compilation-search-path
(while dirs
(when (file-directory-p (car dirs))
(setq list (append list (file-name-all-completions "" (car dirs)))))
(setq dirs (cdr dirs)))
;; prompt the user with the completion list
;; FIXME: option to filter with ada-*-suffixes?
(setq filename (completing-read "File: " list))
;; open it
(find-file (locate-file filename compilation-search-path))
))
This is the same functionality as in 4.01, but somewhat simpler code.
Building the initial list of completions can take a long time, and it is
not cached for subsequent searches. There's probably a way to optimize
this, but I'll worry about that if someone complains.
Would it be useful to provide a variant that filters on
ada-spec-suffixes, ada-body-suffixes? I like the non-filter version; I
can find .texi files, test outputs, Makefiles, etc.
Note that it does _not_ have '(ada-require-project-file); it just uses
compilation-search-path. That's to make it easier to get the default
startup behavior right.
Comments?
> My
> question is really meant for other, yet-unknown functions of ada-mode 4
> that some users might still rely on. I'd like to make them all
> disappear.
Right, that would be ideal.
I propose:
1) add dummy replacements for ada-prj.el, ada-stmt.el, ada-xref.el in
5.x as above
2) add obsolete aliases for the autoloaded functions that are
not defined in 5.x: ada-header
I think that will be sufficient.
--
-- Stephe
_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org