[Python-Dev] Reindenting the C code base?

"Martin v. Löwis" martin at v.loewis.de
Sun Dec 14 21:42:10 CET 2008


> I've never figured out how to configure emacs to deduce whether the
> current file uses spaces or tabs and has a 4 or 8 space indent.

If it is now official policy that different files use different styles,
then I think it would be helpful to put Emacs variables at the end of
each file. See the end of Objects/unicodeobject.c for an example.

I'm not aware of a builtin function that adjusts c-mode automatically;
I could fine a package that does some basic guessing, though:

http://members.iinet.net.au/~bethandmark/elisp/mst-guess-indentation.el
http://www.emacswiki.org/cgi-bin/emacs/guess-offset.el

I've tried the second one briefly. It guesses c-basic-offset fairly
well, but doesn't attempt to guess indent-tabs. This one does; I haven't
tried it yet:

https://savannah.nongnu.org/projects/dtrt-indent/
http://git.savannah.gnu.org/gitweb/?p=dtrt-indent.git;a=blob_plain;f=dtrt-indent.el;hb=HEAD

Regards,
Martin


More information about the Python-Dev mailing list