all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* indentation in c++
@ 2005-03-03 20:58 prab
  2005-03-05  8:41 ` Alan Mackenzie
  0 siblings, 1 reply; 3+ messages in thread
From: prab @ 2005-03-03 20:58 UTC (permalink / raw)


How do I customize Emacs so that when editing a C++ file the
indentation of for loops, etc., will be 3 spaces instead of the default
of 2 spaces? 

We have GNU emacs version 21.2.1

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: indentation in c++
  2005-03-03 20:58 indentation in c++ prab
@ 2005-03-05  8:41 ` Alan Mackenzie
  2005-03-14 16:03   ` prab
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2005-03-05  8:41 UTC (permalink / raw)


prab@spectral.com wrote on 3 Mar 2005 12:58:13 -0800:
> How do I customize Emacs so that when editing a C++ file the
> indentation of for loops, etc., will be 3 spaces instead of the default
> of 2 spaces? 

> We have GNU emacs version 21.2.1

A default of 2 spaces?  UURRRRKKKK!!!   How horrible!

The variable you need to change is c-basic-offset, and it's documented in
the CC Mode manual on the page "Customizing Indentation".  How you would
go about setting it is on the page "Sample .emacs File".

First, why not check through your .emacs and find if it's getting set to
2 there?  If so, just change it.

Otherwise put something like this into your .emacs:

(defun prab-c++-hook ()
  (setq c-basic-offset 3))
(add-hook 'c++-mode-hook 'prab-c++-hook)

(_Don't_ forget the two quote marks in that last line.)

> We have GNU emacs version 21.2.1

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: indentation in c++
  2005-03-05  8:41 ` Alan Mackenzie
@ 2005-03-14 16:03   ` prab
  0 siblings, 0 replies; 3+ messages in thread
From: prab @ 2005-03-14 16:03 UTC (permalink / raw)


Hi Alan:  I appreciate it very much.  It worked when I put it in my
.emacs.  Thanks a lot  Prabhat  Acharya

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-14 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-03 20:58 indentation in c++ prab
2005-03-05  8:41 ` Alan Mackenzie
2005-03-14 16:03   ` prab

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.