emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r108079: Fix mouse wheel scrolling in


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108079: Fix mouse wheel scrolling in Follow mode.
Date: Tue, 01 May 2012 22:00:16 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 108079
fixes bug(s): http://debbugs.gnu.org/4112
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Tue 2012-05-01 22:00:16 +0800
message:
  Fix mouse wheel scrolling in Follow mode.
  
  * lisp/follow.el (follow-mwheel-scroll): New function.
  (follow-redraw-after-event): Fix last change.
modified:
  lisp/ChangeLog
  lisp/follow.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-05-01 13:37:56 +0000
+++ b/lisp/ChangeLog    2012-05-01 14:00:16 +0000
@@ -27,6 +27,7 @@
        (follow-scroll-bar-toolkit-scroll, follow-scroll-bar-drag)
        (follow-scroll-bar-scroll-up, follow-scroll-bar-scroll-down): New
        functions, replacing advice on scroll-bar-* commands.
+       (follow-mwheel-scroll): New function (Bug#4112).
 
        * comint.el (comint-adjust-point): New function.
        (comint-postoutput-scroll-to-bottom): Use it.  Call

=== modified file 'lisp/follow.el'
--- a/lisp/follow.el    2012-05-01 13:37:56 +0000
+++ b/lisp/follow.el    2012-05-01 14:00:16 +0000
@@ -258,6 +258,7 @@
     (define-key mainmap [remap scroll-bar-drag] 'follow-scroll-bar-drag)
     (define-key mainmap [remap scroll-bar-scroll-up] 
'follow-scroll-bar-scroll-up)
     (define-key mainmap [remap scroll-bar-scroll-down] 
'follow-scroll-bar-scroll-down)
+    (define-key mainmap [remap mwheel-scroll] 'follow-mwheel-scroll)
 
     mainmap)
   "Minor mode keymap for Follow mode.")
@@ -1315,17 +1316,24 @@
   (scroll-bar-scroll-down event)
   (follow-redraw-after-event event))
 
+(defun follow-mwheel-scroll (event)
+  (interactive "e")
+  (mwheel-scroll event)
+  (follow-redraw-after-event event))
+
 (defun follow-redraw-after-event (event)
-  "Re-align the Follow mode windows acted on by EVENT."
-  (let ((window (nth 0 (event-end event)))
-       (orig-win (selected-window)))
-    (when (and (buffer-local-value 'follow-mode (window-buffer window))
+  "Re-align the Follow mode windows affected by EVENT."
+  (let* ((window (nth 0 (event-end event)))
+        (buffer (window-buffer window))
+        (orig-win (selected-window)))
+    (when (and (buffer-local-value 'follow-mode buffer)
               ;; Ignore the case where we scroll the selected window;
               ;; that is handled by the post-command hook function.
               (not (eq window (selected-window))))
       (select-window window)
       (follow-redisplay)
-      (select-window orig-win))))
+      (unless (eq (window-buffer orig-win) buffer)
+       (select-window orig-win)))))
 
 ;;; Window size change
 


reply via email to

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