GuessOffset

This library provides a hook for c-mode and related modes. It tries to detect the ‘c-basic-offset’ used for a visited C source file, transparently adapting to different code layouts.

More information in the source commentary.

This is the first release of guess-offset and should be considered beta software. If it happens to guess wrong, you may have to tweak the parameters a little, they are documented. Please share your wisdom in this case.

Comments and suggestions are welcome.

Turning on indent-tab-mode for buffers which use tabs for indentation would be very useful.

Using SmartTabs, there’s no offset to guess. :)

I’ve also written a package for this: GuessStylenschum

Next Generation

There is a successor to ‘guess-offset.el’ called ‘dtrt-indent.el’ which - among other improvements - is now a minor mode, supports additional languages, provides detection of ‘indent-tab-mode’, and has better heuristics. Visit the project page or follow this direct link to HEAD.

Again, suggestions are welcome. Please use Github’s bug tracker as I won’t drop by this page very often. – JulianScheid


CategoryIndentation CcMode