File: cc-guess.el.html

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*:<name-of-file-which-examined-when-guessing>".
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.

Defined variables (4)

c-guess-guessed-basic-offsetCurrently guessed basic-offset.
c-guess-guessed-offsets-alistCurrently guessed offsets-alist.
c-guess-offset-thresholdThreshold of acceptable offsets when examining indent information.
c-guess-region-maxThe maximum region size for examining indent information with ‘c-guess’.

Defined functions (26)

c-guess(&optional ACCUMULATE)
c-guess-accumulate(ACCUMULATOR SYNTAX-ELEMENT)
c-guess-accumulate-offset(ACCUMULATOR SYMBOL OFFSET)
c-guess-buffer(&optional ACCUMULATE)
c-guess-buffer-no-install(&optional ACCUMULATE)
c-guess-current-offset(RELPOS)
c-guess-dump-accumulator()
c-guess-dump-guessed-style(&optional PRINTER)
c-guess-dump-guessed-values()
c-guess-examine(START END ACCUMULATOR)
c-guess-guess(ACCUMULATOR)
c-guess-install(&optional STYLE-NAME)
c-guess-make-basic-offset(ACCUMULATOR)
c-guess-make-offsets-alist(ACCUMULATOR)
c-guess-make-style(BASIC-OFFSET OFFSETS-ALIST)
c-guess-merge-offsets-alists(STRONG WEAK)
c-guess-no-install(&optional ACCUMULATE)
c-guess-region(START END &optional ACCUMULATE)
c-guess-region-no-install(START END &optional ACCUMULATE)
c-guess-reset-accumulator()
c-guess-sort-accumulator(ACCUMULATOR)
c-guess-symbolize-integer(INT BASIC-OFFSET)
c-guess-symbolize-offsets-alist(OFFSETS-ALIST BASIC-OFFSET)
c-guess-view(&optional WITH-NAME)
c-guess-view-mark-guessed-entries(GUESSED-SYNTACTIC-SYMBOLS)
c-guess-view-reorder-offsets-alist-in-style(STYLE GUESSED-SYNTACTIC-SYMBOLS)

Defined faces (0)