cc-guess

Homepage: https://www.gnu.org/software/emacs

Summary

Guess indentation values by scanning existing code

Commentary

This file contains routines that help guess the cc-mode style in a
particular region/buffer.  Here style means `c-offsets-alist' and
`c-basic-offset'.

The main entry point of this program is `c-guess' command but there
are some variants.

Suppose the major mode for the current buffer is one of the modes
provided by cc-mode.  `c-guess' guesses the indentation style by
examining the indentation in the region between beginning of buffer
and `c-guess-region-max'.

and installs the guessed style.  The name for installed style is given
by `c-guess-style-name'.

`c-guess-buffer' does the same but in the whole buffer.
`c-guess-region' does the same but in the region between the point
and the mark.  `c-guess-no-install', `c-guess-buffer-no-install'
and `c-guess-region-no-install' guess the indentation style but
don't install it.  You can review a guessed style with `c-guess-view'.
After reviewing, use `c-guess-install' to install the style
if you prefer it.

If you want to reuse the guessed style in another buffer,
run `c-set-style' command with the name of the guessed style:
"*c-guess*:".
Once the guessed style is installed explicitly with `c-guess-install'
or implicitly with `c-guess', `c-guess-buffer', or `c-guess-region',
a style name is given by `c-guess-style-name' with the above form.

If you want to reuse the guessed style in future Emacs sessions,
you may want to put it to your .emacs.  `c-guess-view' is for
you.  It emits Emacs Lisp code which defines the last guessed
style, in a temporary buffer.  You can put the emitted code into
your .emacs.  This command was suggested by Alan Mackenzie.

Dependencies

Reverse dependencies