summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-11-29 15:09:37 +0000
committerRichard M. Stallman <rms@gnu.org>2002-11-29 15:09:37 +0000
commit140011ea7f6243eb547da370195f4983f4025d22 (patch)
tree0f44ff1b038612e8ccb667d6f1bd817e02f4578c /lisp/simple.el
parent843f6d48b55b56617ea751a677eb84fff0e39f4d (diff)
downloademacs-140011ea7f6243eb547da370195f4983f4025d22.tar.gz
(yank-window-start): New variable.
(yank): Record yank-window-start (yank-pop): Use yank-window-start.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 08dd0474fbf..0b3c14d72ac 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1930,6 +1930,8 @@ The argument is used for internal purposes; do not supply one."
:group 'editing
:version "21.4")
+(defvar yank-window-start nil)
+
(defun yank-pop (arg)
"Replace just-yanked stretch of killed text with a different stretch.
This command is allowed only immediately after a `yank' or a `yank-pop'.
@@ -1952,6 +1954,9 @@ comes the newest one."
(delete-region (point) (mark t))
(set-marker (mark-marker) (point) (current-buffer))
(insert-for-yank (current-kill arg))
+ ;; Set the window start back where it was in the yank command,
+ ;; if possible.
+ (set-window-start (selected-window) yank-window-start t)
(if before
;; This is like exchange-point-and-mark, but doesn't activate the mark.
;; It is cleaner to avoid activation, even though the command
@@ -1969,6 +1974,7 @@ With argument N, reinsert the Nth most recently killed stretch of killed
text.
See also the command \\[yank-pop]."
(interactive "*P")
+ (setq yank-window-start (window-start))
;; If we don't get all the way thru, make last-command indicate that
;; for the following command.
(setq this-command t)