help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to indent


From: Alan Mackenzie
Subject: Re: how to indent
Date: Tue, 14 Mar 2006 20:28:39 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

billy <bp1497@att.com> wrote on 14 Mar 2006 03:59:06 -0800:
> My original source was built using vim with auto indent shut off.  Now
> every line I enter new gets indented different that what I had.  I had
> vim set for tab to be 2 spaces.  How can I force the remainder of a
> file to indent to the standards of what emacs has as auto indenting.  A
> pretty print ?

What sort of file is this?  C, C++, perl, Fortran, Cobol, Python, ....?
It makes a difference to what you need to do.

However, if you're talking about C, try writing the following into your
.emacs[*]:

(setq c-basic-offset 2)

, which will set the indentation step to 2 characters.  To re-indent the
whole file in one go (you're a braver man than I ;-), do C-x h (which
"marks" the whole buffer) and then C-M-\ (that's
"control-meta-backslash", where the "meta" key is (probably) your left
alt key).

[*] If you haven't got one, do "C-x C-f ~/.emacs" (that's
"control-x,control-x", followed by "~/.emacs").  Then you'll have one.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]