[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ada-mode-users] Usage of compilation-search-path considered harmful
From: |
Ludovic Brenta |
Subject: |
[Ada-mode-users] Usage of compilation-search-path considered harmful |
Date: |
Fri, 27 Jan 2017 13:02:02 +0100 |
User-agent: |
Roundcube Webmail/0.5.3 |
Hello,
compile.el contains:
(defcustom compilation-search-path '(nil)
"List of directories to search for source files named in error
messages.
Elements should be directory names, not file names of directories.
The value nil as an element means to try the default directory."
:type '(repeat (choice (const :tag "Default" nil)
(string :tag "Directory")))
:group 'compilation)
As can be seen, the intention is to navigate from a compilation buffer
to
a source file, not between source files. Therefore, it is my opinion
that
this variable should always be buffer-local to a compilation buffer.
Also,
the fact that this variable is defined by "defcustom" implies that it
is
intended to be under the sole control of the human user, by means of
customize-variables.
I think ada-mode violates both of these principles and has done so for
many
years. Grepping in emacs 24.5, I see that only ada-mode 4.00 ever
mentions
compilation-search-path; I have not investigated why. No other
programming
mode does that.
ada-mode 5.2.1 sets this variable when parsing a project file (either
.gpr
or .adp). This has the following effects:
* when a user does M-x compile, whatever compilation results in the
buffer
will use compilation-search-path, even if the compilation has nothing
to
do with the ada-prj-current-file. The user may start an arbitrary
compilation command, e.g. to compile some COBOL files :)
* when a user does M-x grep, this opens a *grep* buffer which inherits
from
compilation-mode and therefore uses compilation-search-path. This is
harmful because the user controls where grep runs and certainly does
not
want files in the compilation-search-path to hide ones in the grep
results.
* when a user does M-x occur, this also opens a *occur* buffer which
inherits
from compilation-mode, so the same remark applies.
After lengthy discussions with my colleagues and some more lengthy
meditation
on this, I have reached the conclusion that is is best that ada-mode
*not*
use, mention or change compilation-search-path at all. Navigation from
one
source buffer to another (e.g. ada-goto-declaration) uses other means,
namely
a gnatfind buffer; and navigation from a compilation buffer to source
should
use a buffer-local value in the compilation buffer. If
compilation-search-
path is nil, emacs has a reasonable default for this.
A first glance at the usage of compilation-search-path in ada-mode
5.2.1
tells me that there is no compelling reason for it.
Opinions anyone?
--
Ludovic Brenta.
- [Ada-mode-users] Usage of compilation-search-path considered harmful,
Ludovic Brenta <=