From ff71884063d048e8f8c03de27d2bac343df4f77a Mon Sep 17 00:00:00 2001 From: Antoine Tremblay Date: Tue, 20 Dec 2016 08:42:10 -0500 Subject: Set emacs default mode for the GDB directory to C++ Since GDB has switched to C++ but the file names are still .c emacs does not load the proper mode when opening files in the gdb directory. This patch fixes that by enabling c++ mode. This patch also fixes indentation tweaks as discussed in this thread: https://sourceware.org/ml/gdb-patches/2016-12/msg00074.html Indent with gdb-code-style.el included and the .dir-locals.el is as such: namespace TestNameSpace { class test { public: test test() {} int m_a; }; struct teststruct { int a; } } gdb/ChangeLog: * .dir-locals.el: Set c++ mode for the directory and set indent properly. * gdb-code-style.el: Set c-set-offset 'innamespace as a safe value to be used in .dir-locals.el. --- gdb/gdb-code-style.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gdb/gdb-code-style.el') diff --git a/gdb/gdb-code-style.el b/gdb/gdb-code-style.el index 6099c1d..a7f4d8b 100644 --- a/gdb/gdb-code-style.el +++ b/gdb/gdb-code-style.el @@ -74,4 +74,9 @@ ) (add-hook 'c-mode-common-hook 'gdb-comment-hook) +;; Set c-set-offset 'innamespace as a safe value to be used in .dir-locals.el. +(setq safe-local-variable-values + (cons safe-local-variable-values + '((eval c-set-offset 'innamespace 0) + (c-offsets-alist (innamespace . 0))))) ;;; gdb-code-style.el ends here -- cgit v1.1