This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: Teaching emacs about GCC coding conventions (was Re: [PATCH] tree_code_name wrapper)


On Oct 16, 2013, at 9:26 AM, Tom Tromey <tromey@redhat.com> wrote:
> Andreas> You could put it in .dir-locals.el, or put a hook on
> Andreas> find-file-hook that looks at buffer-file-name.

> We checked in a .dir-locals.el for gdb.  I recommend it for GCC as well.

I've copied the gdb one and updated it for our tree:

$ cat .dir-locals.el
;; Emacs settings.
;; Copyright (C) 2012-2013 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://gcc.gnu.org/PR%s";)))
 (c-mode . ((c-file-style . "GNU")
	    (indent-tabs-mode . t)))
)

Committed revision 203715.

I've tested it to ensure everything works as expected, except I didn't see exactly how to test the bug-reference…  If someone knows how to test that, I'd appreciate it.  If I understand the net result of this, it should make the lives of people that work on multiple trees with different formatting easier.

Thanks guys.

Now, if you've been manually fidgeting with tab characters, you should be able to just hit tab on the line your editing and have it do the right thing (if your emacs isn't really old).

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