aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/simple.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index d4eac802e33..243b1eeb211 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -28,7 +28,17 @@ With arg N, insert N newlines."
28 (interactive "*p") 28 (interactive "*p")
29 (let* ((do-fill-prefix (and fill-prefix (bolp))) 29 (let* ((do-fill-prefix (and fill-prefix (bolp)))
30 (flag (and (null do-fill-prefix) (bolp) (not (bobp))))) 30 (flag (and (null do-fill-prefix) (bolp) (not (bobp)))))
31 (if flag (forward-char -1)) 31 ;; If this is a simple case, and we are at the beginning of a line,
32 ;; actually insert the newline *before* the preceding newline
33 ;; instead of after. That makes better display behavior.
34 (if flag
35 (progn
36 ;; If undo is enabled, don't let this hack be visible:
37 ;; record the real value of point as the place to move back to
38 ;; if we undo this insert.
39 (if (and buffer-undo-list (not (eq buffer-undo-list t)))
40 (setq buffer-undo-list (cons (point) buffer-undo-list)))
41 (forward-char -1)))
32 (while (> arg 0) 42 (while (> arg 0)
33 (save-excursion 43 (save-excursion
34 (insert ?\n)) 44 (insert ?\n))