public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdbserver: Add .dir-locals.el file
@ 2020-03-02  9:53 Andrew Burgess
  2020-03-02 10:17 ` Aktemur, Tankut Baris
  2020-03-02 10:19 ` [PATCH] " Aktemur, Tankut Baris
  0 siblings, 2 replies; 15+ messages in thread
From: Andrew Burgess @ 2020-03-02  9:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Add a .dir-locals.el file into the gdbserver directory so that we get
the GNU style when editing these files in Emacs.

I copied this file over from the gdb/ directory and the only change I
made was to remove (mode . c++) from the c-mode settings.  The reason
for this is that all C++ files in the gdbserver/ directory now have
the .cc suffix, and we don't (currently) have any .c files in there. I
assume that if did add a .c file in the future, it really would be C,
not C++, so forcing c++-mode seems like the wrong thing to do.

The copyright date in the new file is left as for gdb/.dir-locals.el,
as the new file is an exact copy with one line removed.

gdbserver/ChangeLog:

	* .dir-locals.el: New file.
---
 gdbserver/.dir-locals.el | 36 ++++++++++++++++++++++++++++++++++++
 gdbserver/ChangeLog      |  4 ++++
 2 files changed, 40 insertions(+)
 create mode 100644 gdbserver/.dir-locals.el

diff --git a/gdbserver/.dir-locals.el b/gdbserver/.dir-locals.el
new file mode 100644
index 00000000000..28a6df0de07
--- /dev/null
+++ b/gdbserver/.dir-locals.el
@@ -0,0 +1,36 @@
+;; Emacs settings.
+;; Copyright (C) 2012-2020 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+(
+ (tcl-mode . ((tcl-indent-level . 4)
+	      (tcl-continued-indent-level . 4)
+	      (indent-tabs-mode . t)))
+ (nil . ((bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s")))
+ (c-mode . ((c-file-style . "GNU")
+	    (indent-tabs-mode . t)
+	    (tab-width . 8)
+	    (c-basic-offset . 2)
+	    (eval . (c-set-offset 'innamespace 0))
+	    ))
+ (c++-mode . ((eval . (when (fboundp 'c-toggle-comment-style)
+			(c-toggle-comment-style 1)))
+	      (indent-tabs-mode . t)
+	      (tab-width . 8)
+	      (c-file-style . "GNU")
+	      (c-basic-offset . 2)
+	      (eval . (c-set-offset 'innamespace 0))
+	      ))
+)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH] gdbserver: Add .dir-locals.el file
  2020-03-02  9:53 [PATCH] gdbserver: Add .dir-locals.el file Andrew Burgess
@ 2020-03-02 10:17 ` Aktemur, Tankut Baris
  2020-03-02 12:31   ` [PATCHv2] " Andrew Burgess
  2020-03-02 10:19 ` [PATCH] " Aktemur, Tankut Baris
  1 sibling, 1 reply; 15+ messages in thread
From: Aktemur, Tankut Baris @ 2020-03-02 10:17 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

On Monday, March 2, 2020 10:53 AM, Andrew Burgess wrote:
> Add a .dir-locals.el file into the gdbserver directory so that we get
> the GNU style when editing these files in Emacs.
> 
> I copied this file over from the gdb/ directory and the only change I
> made was to remove (mode . c++) from the c-mode settings.  The reason
> for this is that all C++ files in the gdbserver/ directory now have
> the .cc suffix, and we don't (currently) have any .c files in there. I
> assume that if did add a .c file in the future, it really would be C,
> not C++, so forcing c++-mode seems like the wrong thing to do.

Because the header files are still .h, Emacs opens them in C mode. Can a
mode specification be included to use C++ mode for .h files, please?

Thanks.
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH] gdbserver: Add .dir-locals.el file
  2020-03-02  9:53 [PATCH] gdbserver: Add .dir-locals.el file Andrew Burgess
  2020-03-02 10:17 ` Aktemur, Tankut Baris
@ 2020-03-02 10:19 ` Aktemur, Tankut Baris
  2020-03-02 12:02   ` Andrew Burgess
  1 sibling, 1 reply; 15+ messages in thread
From: Aktemur, Tankut Baris @ 2020-03-02 10:19 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

On Monday, March 2, 2020 10:53 AM, Andrew Burgess wrote:
> Add a .dir-locals.el file into the gdbserver directory so that we get
> the GNU style when editing these files in Emacs.
> 
> I copied this file over from the gdb/ directory and the only change I
> made was to remove (mode . c++) from the c-mode settings.  The reason
> for this is that all C++ files in the gdbserver/ directory now have
> the .cc suffix, and we don't (currently) have any .c files in there. I
> assume that if did add a .c file in the future, it really would be C,
> not C++, so forcing c++-mode seems like the wrong thing to do.
> 
> The copyright date in the new file is left as for gdb/.dir-locals.el,
> as the new file is an exact copy with one line removed.
> 
> gdbserver/ChangeLog:
> 
> 	* .dir-locals.el: New file.
> ---
>  gdbserver/.dir-locals.el | 36 ++++++++++++++++++++++++++++++++++++
>  gdbserver/ChangeLog      |  4 ++++
>  2 files changed, 40 insertions(+)
>  create mode 100644 gdbserver/.dir-locals.el
> 
> diff --git a/gdbserver/.dir-locals.el b/gdbserver/.dir-locals.el
> new file mode 100644
> index 00000000000..28a6df0de07
> --- /dev/null
> +++ b/gdbserver/.dir-locals.el
> @@ -0,0 +1,36 @@
> +;; Emacs settings.
> +;; Copyright (C) 2012-2020 Free Software Foundation, Inc.

... and I think they year needs to be just '2020'.

Thanks.
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gdbserver: Add .dir-locals.el file
  2020-03-02 10:19 ` [PATCH] " Aktemur, Tankut Baris
@ 2020-03-02 12:02   ` Andrew Burgess
  2020-03-02 14:05     ` Pedro Alves
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Burgess @ 2020-03-02 12:02 UTC (permalink / raw)
  To: Aktemur, Tankut Baris; +Cc: gdb-patches

* Aktemur, Tankut Baris <tankut.baris.aktemur@intel.com> [2020-03-02 10:19:28 +0000]:

> On Monday, March 2, 2020 10:53 AM, Andrew Burgess wrote:
> > Add a .dir-locals.el file into the gdbserver directory so that we get
> > the GNU style when editing these files in Emacs.
> > 
> > I copied this file over from the gdb/ directory and the only change I
> > made was to remove (mode . c++) from the c-mode settings.  The reason
> > for this is that all C++ files in the gdbserver/ directory now have
> > the .cc suffix, and we don't (currently) have any .c files in there. I
> > assume that if did add a .c file in the future, it really would be C,
> > not C++, so forcing c++-mode seems like the wrong thing to do.
> > 
> > The copyright date in the new file is left as for gdb/.dir-locals.el,
> > as the new file is an exact copy with one line removed.
> > 
> > gdbserver/ChangeLog:
> > 
> > 	* .dir-locals.el: New file.
> > ---
> >  gdbserver/.dir-locals.el | 36 ++++++++++++++++++++++++++++++++++++
> >  gdbserver/ChangeLog      |  4 ++++
> >  2 files changed, 40 insertions(+)
> >  create mode 100644 gdbserver/.dir-locals.el
> > 
> > diff --git a/gdbserver/.dir-locals.el b/gdbserver/.dir-locals.el
> > new file mode 100644
> > index 00000000000..28a6df0de07
> > --- /dev/null
> > +++ b/gdbserver/.dir-locals.el
> > @@ -0,0 +1,36 @@
> > +;; Emacs settings.
> > +;; Copyright (C) 2012-2020 Free Software Foundation, Inc.
> 
> ... and I think they year needs to be just '2020'.

As per this rule:

  https://sourceware.org/gdb/wiki/ContributionChecklist#Copyright_Header

When copying a file the start date of the original file should be
maintained I think.

Thanks,
Andrew



> 
> Thanks.
> -Baris
> 
> 
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de
> Managing Directors: Christin Eisenschmid, Gary Kershaw
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-02 10:17 ` Aktemur, Tankut Baris
@ 2020-03-02 12:31   ` Andrew Burgess
  2020-03-02 14:06     ` Pedro Alves
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Burgess @ 2020-03-02 12:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Baris,

Good spot on the *.h files, I hadn't considered them.  I did look
breifly at how I might change the mode only for *.h files, but
couldn't see anything obvious, and as we don't currently have any *.c
files I just restored the c-mode to c++-mode setting.

Thanks,
Andrew


---

Copy the .dir-locls.el file from gdb/ to gdbserver/ so that we get the
GNU style when editing these files in Emacs.

I initially wanted to remove the (c-mode . ((mode . c++))) that
switches c-mode files into c++-mode as we store C++ code in *.cc files
in the gdbserver/ directory, unlike gdb/ where we use *.c, however, I
was forgetting about the header files - we still use *.h for our C++
header files, so for now I left the settings in place to open all C
files in c++-mode.

The copyright date in the new file is left as for gdb/.dir-locals.el,
as the new file is a copy of the old with just one new comment
added, this is inline with this rule:

  https://sourceware.org/gdb/wiki/ContributionChecklist#Copyright_Header

gdbserver/ChangeLog:

	* .dir-locals.el: New file.
---
 gdbserver/.dir-locals.el | 39 +++++++++++++++++++++++++++++++++++++++
 gdbserver/ChangeLog      |  4 ++++
 2 files changed, 43 insertions(+)
 create mode 100644 gdbserver/.dir-locals.el

diff --git a/gdbserver/.dir-locals.el b/gdbserver/.dir-locals.el
new file mode 100644
index 00000000000..29c3d69869e
--- /dev/null
+++ b/gdbserver/.dir-locals.el
@@ -0,0 +1,39 @@
+;; Emacs settings.
+;; Copyright (C) 2012-2020 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+(
+ (tcl-mode . ((tcl-indent-level . 4)
+	      (tcl-continued-indent-level . 4)
+	      (indent-tabs-mode . t)))
+ (nil . ((bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s")))
+ ;; We store C++ headers in files matching *.h, which is usually for C
+ ;; headers, so here we arrange to switch all c-mode files into c++-mode.
+ (c-mode . ((c-file-style . "GNU")
+	    (mode . c++)
+	    (indent-tabs-mode . t)
+	    (tab-width . 8)
+	    (c-basic-offset . 2)
+	    (eval . (c-set-offset 'innamespace 0))
+	    ))
+ (c++-mode . ((eval . (when (fboundp 'c-toggle-comment-style)
+			(c-toggle-comment-style 1)))
+	      (indent-tabs-mode . t)
+	      (tab-width . 8)
+	      (c-file-style . "GNU")
+	      (c-basic-offset . 2)
+	      (eval . (c-set-offset 'innamespace 0))
+	      ))
+)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] gdbserver: Add .dir-locals.el file
  2020-03-02 12:02   ` Andrew Burgess
@ 2020-03-02 14:05     ` Pedro Alves
  0 siblings, 0 replies; 15+ messages in thread
From: Pedro Alves @ 2020-03-02 14:05 UTC (permalink / raw)
  To: Andrew Burgess, Aktemur, Tankut Baris; +Cc: gdb-patches

On 3/2/20 12:02 PM, Andrew Burgess wrote:

>>> +;; Copyright (C) 2012-2020 Free Software Foundation, Inc.
>>
>> ... and I think they year needs to be just '2020'.
> 
> As per this rule:
> 
>   https://sourceware.org/gdb/wiki/ContributionChecklist#Copyright_Header
> 
> When copying a file the start date of the original file should be
> maintained I think.

Yes, otherwise we could put just "2020" everywhere using this:

 $ cp org.c new.c
 # I have a new file, so let me update copyright to 2020:
 $ sed s/20*-2020/2020/g -i new.c
 # Rename the new file back to the old name:
 $ mv new.c org.c

Copyright covers the code, the file's content, not the file name.

Pedro Alves

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-02 12:31   ` [PATCHv2] " Andrew Burgess
@ 2020-03-02 14:06     ` Pedro Alves
  2020-03-02 17:08       ` Andrew Burgess
  0 siblings, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2020-03-02 14:06 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

On 3/2/20 12:31 PM, Andrew Burgess wrote:
> Baris,
> 
> Good spot on the *.h files, I hadn't considered them.  I did look
> breifly at how I might change the mode only for *.h files, but
> couldn't see anything obvious, and as we don't currently have any *.c
> files I just restored the c-mode to c++-mode setting.
> 
> Thanks,
> Andrew
> 
> 
> ---
> 
> Copy the .dir-locls.el file from gdb/ to gdbserver/ so that we get the
> GNU style when editing these files in Emacs.

I think we want this in gdbsupport/ as well?

Since this is now just a plain copy with no modifications, can't we
source the original file instead of copying it?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-02 14:06     ` Pedro Alves
@ 2020-03-02 17:08       ` Andrew Burgess
  2020-03-02 17:34         ` Pedro Alves
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Burgess @ 2020-03-02 17:08 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

* Pedro Alves <palves@redhat.com> [2020-03-02 14:06:46 +0000]:

> On 3/2/20 12:31 PM, Andrew Burgess wrote:
> > Baris,
> > 
> > Good spot on the *.h files, I hadn't considered them.  I did look
> > breifly at how I might change the mode only for *.h files, but
> > couldn't see anything obvious, and as we don't currently have any *.c
> > files I just restored the c-mode to c++-mode setting.
> > 
> > Thanks,
> > Andrew
> > 
> > 
> > ---
> > 
> > Copy the .dir-locls.el file from gdb/ to gdbserver/ so that we get the
> > GNU style when editing these files in Emacs.
> 
> I think we want this in gdbsupport/ as well?
> 
> Since this is now just a plain copy with no modifications, can't we
> source the original file instead of copying it?

I'm not aware of a way to import one .dir-locals from another, I did
some searching and couldn't find anything promising.

Given that would you accept 3 copies of the file?

Thanks,
Andrew

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-02 17:08       ` Andrew Burgess
@ 2020-03-02 17:34         ` Pedro Alves
  2020-03-02 17:58           ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2020-03-02 17:34 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches, Eli Zaretskii

On 3/2/20 5:08 PM, Andrew Burgess wrote:
> * Pedro Alves <palves@redhat.com> [2020-03-02 14:06:46 +0000]:
> 
>> On 3/2/20 12:31 PM, Andrew Burgess wrote:
>>> Baris,
>>>
>>> Good spot on the *.h files, I hadn't considered them.  I did look
>>> breifly at how I might change the mode only for *.h files, but
>>> couldn't see anything obvious, and as we don't currently have any *.c
>>> files I just restored the c-mode to c++-mode setting.
>>>
>>> Thanks,
>>> Andrew
>>>
>>>
>>> ---
>>>
>>> Copy the .dir-locls.el file from gdb/ to gdbserver/ so that we get the
>>> GNU style when editing these files in Emacs.
>>
>> I think we want this in gdbsupport/ as well?
>>
>> Since this is now just a plain copy with no modifications, can't we
>> source the original file instead of copying it?
> 
> I'm not aware of a way to import one .dir-locals from another, I did
> some searching and couldn't find anything promising.
> 

Let's ask an Emacs maintainer.

Eli, what's the best way to handle this?

> Given that would you accept 3 copies of the file?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-02 17:34         ` Pedro Alves
@ 2020-03-02 17:58           ` Eli Zaretskii
  2020-03-02 18:13             ` Pedro Alves
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2020-03-02 17:58 UTC (permalink / raw)
  To: Pedro Alves; +Cc: andrew.burgess, gdb-patches

> Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
> From: Pedro Alves <palves@redhat.com>
> Date: Mon, 2 Mar 2020 17:34:20 +0000
> 
> > I'm not aware of a way to import one .dir-locals from another, I did
> > some searching and couldn't find anything promising.
> > 
> 
> Let's ask an Emacs maintainer.
> 
> Eli, what's the best way to handle this?

Put a single file in the parent directory of those 3, I think.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-02 17:58           ` Eli Zaretskii
@ 2020-03-02 18:13             ` Pedro Alves
  2020-03-02 19:19               ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2020-03-02 18:13 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: andrew.burgess, gdb-patches

On 3/2/20 5:58 PM, Eli Zaretskii wrote:
>> Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
>> From: Pedro Alves <palves@redhat.com>
>> Date: Mon, 2 Mar 2020 17:34:20 +0000
>>
>>> I'm not aware of a way to import one .dir-locals from another, I did
>>> some searching and couldn't find anything promising.
>>>
>>
>> Let's ask an Emacs maintainer.
>>
>> Eli, what's the best way to handle this?
> 
> 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.  

OOC, if we wanted to say, source "../gdb/.dir-locals.el" from
a gdbserver/.dir-locals.el file, would it be possible?

I guess a symlink would do too.  Except that might not work
as nicely on Windows filesystems.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-02 18:13             ` Pedro Alves
@ 2020-03-02 19:19               ` Eli Zaretskii
  2020-03-05 15:12                 ` Andrew Burgess
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2020-03-02 19:19 UTC (permalink / raw)
  To: Pedro Alves; +Cc: andrew.burgess, gdb-patches

> 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.

> 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.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-02 19:19               ` Eli Zaretskii
@ 2020-03-05 15:12                 ` Andrew Burgess
  2020-03-05 15:26                   ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Burgess @ 2020-03-05 15:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Pedro Alves, gdb-patches

* 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.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-05 15:12                 ` Andrew Burgess
@ 2020-03-05 15:26                   ` Eli Zaretskii
  2020-03-05 16:00                     ` Pedro Alves
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2020-03-05 15:26 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: palves, gdb-patches

> Date: Thu, 5 Mar 2020 15:12:32 +0000
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
> 
> > > > 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:

Yes, I think this is correct.

> 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 ......".

I'm okay with that as well, if people prefer it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCHv2] gdbserver: Add .dir-locals.el file
  2020-03-05 15:26                   ` Eli Zaretskii
@ 2020-03-05 16:00                     ` Pedro Alves
  0 siblings, 0 replies; 15+ messages in thread
From: Pedro Alves @ 2020-03-05 16:00 UTC (permalink / raw)
  To: Eli Zaretskii, Andrew Burgess; +Cc: gdb-patches

On 3/5/20 3:26 PM, Eli Zaretskii wrote:
>> Date: Thu, 5 Mar 2020 15:12:32 +0000
>> From: Andrew Burgess <andrew.burgess@embecosm.com>
>> Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
>>
>>>>> 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:
> 
> Yes, I think this is correct.

Thanks for exploring this.

> 
>> 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 ......".
> 
> I'm okay with that as well, if people prefer it.

Yes, let's do that.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-03-05 16:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02  9:53 [PATCH] gdbserver: Add .dir-locals.el file Andrew Burgess
2020-03-02 10:17 ` Aktemur, Tankut Baris
2020-03-02 12:31   ` [PATCHv2] " Andrew Burgess
2020-03-02 14:06     ` Pedro Alves
2020-03-02 17:08       ` Andrew Burgess
2020-03-02 17:34         ` Pedro Alves
2020-03-02 17:58           ` Eli Zaretskii
2020-03-02 18:13             ` Pedro Alves
2020-03-02 19:19               ` Eli Zaretskii
2020-03-05 15:12                 ` Andrew Burgess
2020-03-05 15:26                   ` Eli Zaretskii
2020-03-05 16:00                     ` Pedro Alves
2020-03-02 10:19 ` [PATCH] " Aktemur, Tankut Baris
2020-03-02 12:02   ` Andrew Burgess
2020-03-02 14:05     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).