unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to indent
@ 2006-03-14 11:59 billy
  2006-03-14 20:28 ` Alan Mackenzie
  0 siblings, 1 reply; 2+ messages in thread
From: billy @ 2006-03-14 11:59 UTC (permalink / raw)


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 ?

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

* Re: how to indent
  2006-03-14 11:59 how to indent billy
@ 2006-03-14 20:28 ` Alan Mackenzie
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Mackenzie @ 2006-03-14 20:28 UTC (permalink / raw)


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

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

end of thread, other threads:[~2006-03-14 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-14 11:59 how to indent billy
2006-03-14 20:28 ` Alan Mackenzie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).