diff mbox

gdbserver: Add .dir-locals.el file

Message ID 20200302095303.4474-1-andrew.burgess@embecosm.com
State New
Headers show

Commit Message

Andrew Burgess March 2, 2020, 9:53 a.m. UTC
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

Comments

Tankut Baris Aktemur March 2, 2020, 10:17 a.m. UTC | #1
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
Tankut Baris Aktemur March 2, 2020, 10:19 a.m. UTC | #2
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
Andrew Burgess March 2, 2020, 12:02 p.m. UTC | #3
* 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
Pedro Alves March 2, 2020, 2:04 p.m. UTC | #4
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
diff mbox

Patch

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))
+	      ))
+)