This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: naive GDB programming style questions
- From: Tom Tromey <tromey at redhat dot com>
- To: David Carlton <carlton at math dot stanford dot edu>
- Cc: gdb <gdb at sources dot redhat dot com>
- Date: 10 Sep 2002 09:43:26 -0600
- Subject: Re: naive GDB programming style questions
- References: <ro1u1kyah7d.fsf@jackfruit.Stanford.EDU>
- Reply-to: tromey at redhat dot com
>>>>> "David" == David Carlton <carlton@math.stanford.edu> writes:
David> 3) Is it possible to get CC Mode to indent in the way that GDB seems
David> to prefer? I'm having a hard time getting structs to be indented
David> as follows:
David> without screwing up my preferred indentation when doing non-GDB
David> programming, namely
Change your settings depending on the file you are editing.
Here is a piece of code I used for this purpose a long time ago. For
C source files in a particular directory, it uses the Tcl style (a
variant of the BSD style); for other files it uses GNU. Rewrite as
appropriate and attach to your c-mode-hook.
(defun tjt-set-c-style ()
(if (and (buffer-file-name)
(string-match "/home/syzygy/tclstuff" (buffer-file-name)))
(progn
(c-set-style "BSD")
(make-local-variable 'c-basic-offset)
(setq c-basic-offset 4))
(c-set-style "GNU")))
There are probably lots of other ways to accomplish the same thing.
And of course you can set anything there; for instance the behavior of
electric braces (that sounds like what you want).
Tom