Function: lisp-indent-line
lisp-indent-line is an interactive and byte-compiled function defined
in lisp-mode.el.gz.
Signature
(lisp-indent-line &optional INDENT)
Documentation
Indent current line as Lisp code.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/lisp-mode.el.gz
(defun lisp-indent-line (&optional indent)
"Indent current line as Lisp code."
(interactive)
(let ((pos (- (point-max) (point)))
(indent (progn (beginning-of-line)
(or indent (calculate-lisp-indent (lisp-ppss))))))
(skip-chars-forward " \t")
(if (or (null indent) (looking-at "\\s<\\s<\\s<"))
;; Don't alter indentation of a ;;; comment line
;; or a line that starts in a string.
;; FIXME: inconsistency: comment-indent moves ;;; to column 0.
(goto-char (- (point-max) pos))
(if (and (looking-at "\\s<") (not (looking-at "\\s<\\s<")))
;; Single-semicolon comment lines should be indented
;; as comment lines, not as code.
(progn (indent-for-comment) (forward-char -1))
(if (listp indent) (setq indent (car indent)))
(indent-line-to indent))
;; If initial point was within line's indentation,
;; position after the indentation. Else stay at same point in text.
(if (> (- (point-max) pos) (point))
(goto-char (- (point-max) pos))))))