diff options
| author | Richard M. Stallman | 1992-10-03 02:21:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-10-03 02:21:51 +0000 |
| commit | 62c48f87e90d4b7ff89082c8b4e833d0804d00c1 (patch) | |
| tree | e09d3f00e010309bb197042c7b61ddc1af826a1c | |
| parent | f28f04cca2914a9fb8178900d60a0a0654670fe1 (diff) | |
| download | emacs-62c48f87e90d4b7ff89082c8b4e833d0804d00c1.tar.gz emacs-62c48f87e90d4b7ff89082c8b4e833d0804d00c1.zip | |
(open-line): Shield undo from the hack to insert at pt-1.
| -rw-r--r-- | lisp/simple.el | 12 |
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)) |