Function: c-guess-region-no-install

c-guess-region-no-install is an autoloaded, interactive and byte-compiled function defined in cc-guess.el.gz.

Signature

(c-guess-region-no-install START END &optional ACCUMULATE)

Documentation

Guess the style on the region; don't install it.

Every line of code in the region is examined and values for the following two variables are guessed:

* c-basic-offset, and
* the indentation values of the various syntactic symbols in
  c-offsets-alist.

The guessed values are put into c-guess-guessed-basic-offset and c-guess-guessed-offsets-alist.

Frequencies of use are taken into account when guessing, so minor inconsistencies in the indentation style shouldn't produce wrong guesses.

If given a prefix argument (or if the optional argument ACCUMULATE is non-nil) then the previous examination is extended, otherwise a new guess is made from scratch.

Note that the larger the region to guess in, the slower the guessing. So you can limit the region with c-guess-region-max.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-guess.el.gz
;;;###autoload
(defun c-guess-region-no-install (start end &optional accumulate)
  "Guess the style on the region; don't install it.

Every line of code in the region is examined and values for the following two
variables are guessed:

* `c-basic-offset', and
* the indentation values of the various syntactic symbols in
  `c-offsets-alist'.

The guessed values are put into `c-guess-guessed-basic-offset' and
`c-guess-guessed-offsets-alist'.

Frequencies of use are taken into account when guessing, so minor
inconsistencies in the indentation style shouldn't produce wrong guesses.

If given a prefix argument (or if the optional argument ACCUMULATE is
non-nil) then the previous examination is extended, otherwise a new
guess is made from scratch.

Note that the larger the region to guess in, the slower the guessing.
So you can limit the region with `c-guess-region-max'."
  (interactive "r\nP")
  (let ((accumulator (when accumulate c-guess-accumulator)))
    (setq c-guess-accumulator (c-guess-examine start end accumulator))
    (let ((pair (c-guess-guess c-guess-accumulator)))
      (setq c-guess-guessed-basic-offset (car pair)
	    c-guess-guessed-offsets-alist (cdr pair)))))