# HG changeset patch # User Chong Yidong # Date 1269447493 14400 # Node ID b6cc517c1044cde34a31b4ed41d51e8d0621a57a # Parent 22bf58a96b3a5d563bd61ca8e879ba43cb7f9cee Fix 2009-11-13 change to append-to-buffer (Bug#5749). * simple.el (append-to-buffer): Ensure that point is preserved if BUFFER is the current buffer. Suggested by YAMAMOTO Mitsuharu. (Bug#5749) diff -r 22bf58a96b3a -r b6cc517c1044 lisp/ChangeLog --- a/lisp/ChangeLog Wed Mar 24 11:57:16 2010 -0400 +++ b/lisp/ChangeLog Wed Mar 24 12:18:13 2010 -0400 @@ -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 -r 22bf58a96b3a -r b6cc517c1044 lisp/simple.el --- a/lisp/simple.el Wed Mar 24 11:57:16 2010 -0400 +++ b/lisp/simple.el Wed Mar 24 12:18:13 2010 -0400 @@ -3473,12 +3473,13 @@ (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.