emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111344: Cleanup comint-postoutput-sc


From: martin rudalics
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111344: Cleanup comint-postoutput-scroll-to-bottom (Bug#13248).
Date: Thu, 27 Dec 2012 08:33:47 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111344
author: Vitalie Spinu  <address@hidden>
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Thu 2012-12-27 08:33:47 +0100
message:
  Cleanup comint-postoutput-scroll-to-bottom (Bug#13248).
  
  * comint.el (comint-adjust-window-point): New function.
  (comint-postoutput-scroll-to-bottom): Call
  comint-adjust-window-point (Bug#13248).
modified:
  lisp/ChangeLog
  lisp/comint.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-26 19:52:56 +0000
+++ b/lisp/ChangeLog    2012-12-27 07:33:47 +0000
@@ -1,3 +1,9 @@
+2012-12-27  Vitalie Spinu  <address@hidden>  (tiny change)
+
+       * comint.el (comint-adjust-window-point): New function.
+       (comint-postoutput-scroll-to-bottom): Call
+       comint-adjust-window-point (Bug#13248).
+
 2012-12-26  Dmitry Gutov  <address@hidden>
 
        * progmodes/ruby-mode.el (auto-mode-alist): `purecopy' the

=== modified file 'lisp/comint.el'
--- a/lisp/comint.el    2012-12-21 02:08:29 +0000
+++ b/lisp/comint.el    2012-12-27 07:33:47 +0000
@@ -2120,19 +2120,31 @@
         ((bound-and-true-p follow-mode)
          (follow-comint-scroll-to-bottom))
         (t
-         (let ((selected (selected-window)))
-           (dolist (w (get-buffer-window-list current nil t))
-             (select-window w)
-             (unwind-protect
-                 (progn
-                   (comint-adjust-point selected)
-                   ;; Optionally scroll to the bottom of the window.
-                   (and comint-scroll-show-maximum-output
-                        (eobp)
-                        (recenter (- -1 scroll-margin))))
-               (select-window selected))))))
+          (dolist (w (get-buffer-window-list current nil t))
+            (comint-adjust-window-point w process)
+            ;; Optionally scroll to the bottom of the window.
+            (and comint-scroll-show-maximum-output
+                 (eq (window-point w) (point-max))
+                 (with-selected-window w
+                   (recenter (- -1 scroll-margin)))))))
       (set-buffer current))))
 
+
+(defun comint-adjust-window-point (window process)
+  "Move point in WINDOW based on Comint settings.
+For point adjustment use the process-mark of PROCESS."
+  (and (< (window-point window) (process-mark process))
+       (or (memq comint-move-point-for-output '(t all))
+           ;; Maybe user wants point to jump to end.
+           (eq comint-move-point-for-output
+               (if (eq (selected-window) window) 'this 'others))
+           ;; If point was at the end, keep it at end.
+           (and (marker-position comint-last-output-start)
+                (>= (window-point window) comint-last-output-start)))
+       (set-window-point window (process-mark process))))
+
+
+;; this function is nowhere used
 (defun comint-adjust-point (selected)
   "Move point in the selected window based on Comint settings.
 SELECTED is the window that was originally selected."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]