This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb/emacs/dir-locals: Update settings for c++-mode


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d9c859da9fff9de47a33f52d75a6fef2495b3fc1

commit d9c859da9fff9de47a33f52d75a6fef2495b3fc1
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Fri Dec 7 10:45:01 2018 +0000

    gdb/emacs/dir-locals: Update settings for c++-mode
    
    The current .dir-locals file for GDB causes files that would usually
    open in c-mode (for example, files ending in .c) to open in c++-mode.
    However, all of the other settings applied for c-mode appear to get
    reset when the file is switched over to c++-mode.
    
    For example, we currently say:
    
     (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)))))
    
    So, when we enter c++-mode `indent-tabs-mode` is reset to its global
    value, as are all of the other settings listed for c-mode.
    
    This commit copies all of the settings (except the `mode` setting)
    from the c-mode list to the c++-mode list.
    
    The emacs documentation doesn't mention that `mode` causes this
    resetting behaviour, so, in case this is an emacs bug, I'm using emacs
    version 26.1.  Having the settings duplicated shouldn't cause any
    problems except for a slight maintenance overhead.
    
    gdb/ChangeLog:
    
    	* .dir-locals.el: Copy most of the settings from c-mode over to
    	c++-mode.

Diff:
---
 gdb/.dir-locals.el | 8 +++++++-
 gdb/ChangeLog      | 5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gdb/.dir-locals.el b/gdb/.dir-locals.el
index 7e2b0cc..d5ca5b3 100644
--- a/gdb/.dir-locals.el
+++ b/gdb/.dir-locals.el
@@ -27,5 +27,11 @@
 	    (eval . (c-set-offset 'innamespace 0))
 	    ))
  (c++-mode . ((eval . (when (fboundp 'c-toggle-comment-style)
-			(c-toggle-comment-style 1)))))
+			(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))
+	      ))
 )
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e744d0b..2e105ae 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-12-07  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* .dir-locals.el: Copy most of the settings from c-mode over to
+	c++-mode.
+
 2018-12-08  Stafford Horne  <shorne@gmail.com>
 
 	* Makefile.in (ALL_TARGET_OBS): Add or1k-linux-tdep.o.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]