Mercurial > emacs
diff lisp/simple.el @ 1321:b56c2c450d49
(open-line): Shield undo from the hack to insert at pt-1.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Sat, 03 Oct 1992 02:21:51 +0000 |
| parents | 6b63876aea1c |
| children | dd2c33afcef2 |
line wrap: on
line diff
--- a/lisp/simple.el Sat Oct 03 02:12:40 1992 +0000 +++ b/lisp/simple.el Sat Oct 03 02:21:51 1992 +0000 @@ -28,7 +28,17 @@ (interactive "*p") (let* ((do-fill-prefix (and fill-prefix (bolp))) (flag (and (null do-fill-prefix) (bolp) (not (bobp))))) - (if flag (forward-char -1)) + ;; If this is a simple case, and we are at the beginning of a line, + ;; actually insert the newline *before* the preceding newline + ;; instead of after. That makes better display behavior. + (if flag + (progn + ;; If undo is enabled, don't let this hack be visible: + ;; record the real value of point as the place to move back to + ;; if we undo this insert. + (if (and buffer-undo-list (not (eq buffer-undo-list t))) + (setq buffer-undo-list (cons (point) buffer-undo-list))) + (forward-char -1))) (while (> arg 0) (save-excursion (insert ?\n))
