# HG changeset patch # User Richard M. Stallman # Date 718078911 0 # Node ID b56c2c450d492f90fc52147666395a085bdf9d85 # Parent c45c4e0cae7d57bf74bf31b213fa95f5f9a1ced5 (open-line): Shield undo from the hack to insert at pt-1. diff -r c45c4e0cae7d -r b56c2c450d49 lisp/simple.el --- 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))