From c069a4804fce13d147634f0cbef02c91cc7d2ed3 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Fri, 17 Mar 2000 22:33:28 +0000 Subject: [PATCH] (append-to-buffer): Update point of windows after insertion. --- lisp/simple.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 17bc9e70e36..3397e24a62a 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2011,9 +2011,16 @@ START and END specify the portion of the current buffer to be copied." (region-beginning) (region-end))) (let ((oldbuf (current-buffer))) (save-excursion - (set-buffer (get-buffer-create buffer)) - (barf-if-buffer-read-only) - (insert-buffer-substring oldbuf start end)))) + (let* ((append-to (get-buffer-create buffer)) + (windows (get-buffer-window-list append-to t t)) + point) + (set-buffer append-to) + (setq point (point)) + (barf-if-buffer-read-only) + (insert-buffer-substring oldbuf start end) + (dolist (window windows) + (when (= (window-point window) point) + (set-window-point window (point)))))))) (defun prepend-to-buffer (buffer start end) "Prepend to specified buffer the text of the region. -- 2.39.5