Skip to content

Commit

Permalink
Set emacs default mode for the GDB directory to C++
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Antoine Tremblay committed Dec 20, 2016
1 parent 11dd08e commit ff71884
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gdb/.dir-locals.el
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@
(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)))
(mode . c++)
(indent-tabs-mode . t)
(tab-width . 8)
(c-basic-offset . 2)
(eval . (c-set-offset 'innamespace 0))
))
)
7 changes: 7 additions & 0 deletions gdb/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2016-12-20 Antoine Tremblay <[email protected]>

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

2016-12-16 Bernhard Heckel <[email protected]>

* darwin-nat-info.c (info_mach_region_command): Use expression_up.
Expand Down
5 changes: 5 additions & 0 deletions gdb/gdb-code-style.el
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ff71884

Please sign in to comment.