Function: indent-according-to-mode
indent-according-to-mode is an interactive and byte-compiled function
defined in indent.el.gz.
Signature
(indent-according-to-mode &optional INHIBIT-WIDEN)
Documentation
Indent line in proper way for current major mode.
Normally, this is done by calling the function specified by the
variable indent-line-function. However, if the value of that
variable is present in the indent-line-ignored-functions variable,
handle it specially (since those functions are used for tabbing);
in that case, indent by aligning to the previous non-blank line.
Ignore restriction, unless the optional argument INHIBIT-WIDEN is non-nil.
Probably introduced at or before Emacs version 1.4.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/indent.el.gz
(defun indent-according-to-mode (&optional inhibit-widen)
"Indent line in proper way for current major mode.
Normally, this is done by calling the function specified by the
variable `indent-line-function'. However, if the value of that
variable is present in the `indent-line-ignored-functions' variable,
handle it specially (since those functions are used for tabbing);
in that case, indent by aligning to the previous non-blank line.
Ignore restriction, unless the optional argument INHIBIT-WIDEN is
non-nil."
(interactive)
(save-restriction
(unless inhibit-widen
(widen))
(syntax-propertize (line-end-position))
(if (memq indent-line-function indent-line-ignored-functions)
;; These functions are used for tabbing, but can't be used for
;; indenting. Replace with something ad-hoc.
(let ((column (save-excursion
(beginning-of-line)
(if (bobp) 0
(beginning-of-line 0)
(if (looking-at "[ \t]*$") 0
(current-indentation))))))
(if (<= (current-column) (current-indentation))
(indent-line-to column)
(save-excursion (indent-line-to column))))
;; The normal case.
(funcall indent-line-function))))