diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a83786a5927aa37e40dc795ab67b8a1517c6a91a..4cfb8549b466dae89162718d6203cbe43229ac54 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-03-24 Chong Yidong + + * simple.el (append-to-buffer): Ensure that point is preserved if + BUFFER is the current buffer. Suggested by YAMAMOTO Mitsuharu. + (Bug#5749) + 2010-03-24 Stefan Monnier * progmodes/make-mode.el (makefile-rule-action-regex): Backtrack less. diff --git a/lisp/simple.el b/lisp/simple.el index 30498ea27047ed1912efb705a646e25ae68059f4..2adf4756dca48f6b6752f28dccfac52d7b156b87 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3473,12 +3473,13 @@ START and END specify the portion of the current buffer to be copied." (windows (get-buffer-window-list append-to t t)) point) (with-current-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)))))))) + (save-excursion + (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.