naive GDB programming style questions
Tom Tromey
tromey@redhat.com
Tue Sep 10 08:56:00 GMT 2002
>>>>> "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
More information about the Gdb
mailing list