This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCHv2] gdbserver: Add .dir-locals.el file
* Eli Zaretskii <eliz@gnu.org> [2020-03-02 21:19:18 +0200]:
> > Cc: andrew.burgess@embecosm.com, gdb-patches@sourceware.org
> > From: Pedro Alves <palves@redhat.com>
> > Date: Mon, 2 Mar 2020 18:12:53 +0000
> >
> > > Put a single file in the parent directory of those 3, I think.
> >
> > Good point. This would affect all projects in the top level,
> > though perhaps the file is right for all of them.
>
> You can arrange for the settings to affect only some of the
> subdirectories, the Emacs manual shows an example of that.
I took a look at the examples, and, if I understand correctly I would
need to do something like:
(("gdb/" . ((tcl-mode . (... settings ...))
(nil . (... settings ...))
(c-mode . (... settings ...))
(c++-mode . (... settings ...))))
("gdbserver/" . ((tcl-mode . (... settings ...))
(nil . (... settings ...))
(c-mode . (... settings ...))
(c++-mode . (... settings ...))))
("gdbsupport/" . ((tcl-mode . (... settings ...))
(nil . (... settings ...))
(c-mode . (... settings ...))
(c++-mode . (... settings ...)))))
As there's no easy way (I think) to define a list of settings then
apply them to multiple directories.
Given how rarely the .dir-locals files change, my instinct is to just
add two new copies, and possibly ensure that all three versions of the
file have a big comment saying "remember to update the other versions
of this file located in ......".
Thoughts welcome,
thanks,
Andrew
>
> > OOC, if we wanted to say, source "../gdb/.dir-locals.el" from
> > a gdbserver/.dir-locals.el file, would it be possible?
>
> .dir-locals.el supports 'eval' forms, so you could in principle do
> anything there. But my advice is to stick to simplicity, for reasons
> of speed of visiting files, if nothing else. Also, maintaining such a
> tricky file would need an Emacs expert, something that is not
> guaranteed (although currently we have several on board).
>
> > I guess a symlink would do too. Except that might not work
> > as nicely on Windows filesystems.
>
> IME, symlinks in versioned directories are a PITA.