diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6d5e77d..dc5a4be 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-12-24 Vitalie Spinu + + * comint.el (comint-postoutput-scroll-to-bottom): Don't reset + buffer point on select-window (Bug#13248). + 2012-12-24 Dmitry Gutov * progmodes/ruby-mode.el: Bump the version to 1.2 (Bug#13200). diff --git a/lisp/comint.el b/lisp/comint.el index cff9afe..fa3764d 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2120,12 +2120,14 @@ This function should be in the list `comint-output-filter-functions'." ((bound-and-true-p follow-mode) (follow-comint-scroll-to-bottom)) (t - (let ((selected (selected-window))) + (let ((selected (selected-window)) + ;; select-window resets point; thus, save + (old-point (point))) (dolist (w (get-buffer-window-list current nil t)) (select-window w) (unwind-protect (progn - (comint-adjust-point selected) + (comint-adjust-point selected old-point) ;; Optionally scroll to the bottom of the window. (and comint-scroll-show-maximum-output (eobp) @@ -2133,9 +2135,12 @@ This function should be in the list `comint-output-filter-functions'." (select-window selected)))))) (set-buffer current)))) -(defun comint-adjust-point (selected) +(defun comint-adjust-point (selected &optional saved-point) "Move point in the selected window based on Comint settings. -SELECTED is the window that was originally selected." +SELECTED is the window that was originally selected. + +If SAVED-POINT is given, use it as reference instead of the +current point." (let ((process (get-buffer-process (current-buffer)))) (and (< (point) (process-mark process)) (or (memq comint-move-point-for-output '(t all)) @@ -2144,7 +2149,8 @@ SELECTED is the window that was originally selected." (if (eq (selected-window) selected) 'this 'others)) ;; If point was at the end, keep it at end. (and (marker-position comint-last-output-start) - (>= (point) comint-last-output-start))) + (>= (or saved-point (point)) + comint-last-output-start))) (goto-char (process-mark process))))) (defun comint-truncate-buffer (&optional _string)