# HG changeset patch # User Richard M. Stallman # Date 1038582577 0 # Node ID 150e7a54d97084c4aebb6af6979d011e096c4913 # Parent cb623072f5da7bacd7f5b6a937b66d6942d47bfc (yank-window-start): New variable. (yank): Record yank-window-start (yank-pop): Use yank-window-start. diff -r cb623072f5da -r 150e7a54d970 lisp/simple.el --- a/lisp/simple.el Fri Nov 29 15:07:49 2002 +0000 +++ b/lisp/simple.el Fri Nov 29 15:09:37 2002 +0000 @@ -1930,6 +1930,8 @@ :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 @@ (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 @@ 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)