Function: open-line
open-line is an interactive and byte-compiled function defined in
simple.el.gz.
Signature
(open-line N)
Documentation
Insert a newline and leave point before it.
If there is a fill prefix and/or a left-margin, insert them on
the new line if the line would have been blank.
With arg N, insert N newlines.
Probably introduced at or before Emacs version 19.29.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun open-line (n)
"Insert a newline and leave point before it.
If there is a fill prefix and/or a `left-margin', insert them on
the new line if the line would have been blank.
With arg N, insert N newlines."
(interactive "*p")
(let* ((do-fill-prefix (and fill-prefix (bolp)))
(do-left-margin (and (bolp) (> (current-left-margin) 0)))
(loc (point-marker))
;; Don't expand an abbrev before point.
(abbrev-mode nil))
(newline n)
(goto-char loc)
(while (> n 0)
(cond ((bolp)
(if do-left-margin (indent-to (current-left-margin)))
(if do-fill-prefix (insert-and-inherit fill-prefix))))
(forward-line 1)
(setq n (1- n)))
(goto-char loc)
;; Necessary in case a margin or prefix was inserted.
(end-of-line)))