This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB 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: naive GDB programming style questions


>>>>> "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


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