diff options
author | Juri Linkov <juri@jurta.org> | 2009-11-25 17:18:26 +0000 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2009-11-25 17:18:26 +0000 |
commit | 7d6b4d3cadac4b8343309388dd5e9e225d6f9f4c (patch) | |
tree | c86e913dbea7e5078fdf7dcfab0c4ec994debb8d /lisp/mwheel.el | |
parent | e237085f039fd84695c0ccd7ffba68b1d218b361 (diff) | |
download | emacs-7d6b4d3cadac4b8343309388dd5e9e225d6f9f4c.tar.gz |
Mouse-wheel scrolling for DocView Continuous mode. (Bug#4896)
* mwheel.el (mwheel-scroll-up-function)
(mwheel-scroll-down-function): New defvars.
(mwheel-scroll): Funcall `mwheel-scroll-up-function' instead of
`scroll-up', and `mwheel-scroll-down-function' instead of
`scroll-down'.
* doc-view.el (doc-view-scroll-up-or-next-page)
(doc-view-scroll-down-or-previous-page): Add optional ARG.
Use this ARG in the call to image-scroll-up/image-scroll-down.
Change `interactive' spec to "P". Goto next/previous page only
when `doc-view-continuous-mode' is non-nil or ARG is nil (for the
SPC/DEL case). Doc fix.
(doc-view-next-line-or-next-page)
(doc-view-previous-line-or-previous-page): Rename arg to ARG
for consistency.
(doc-view-mode): Set buffer-local `mwheel-scroll-up-function' to
`doc-view-scroll-up-or-next-page', and buffer-local
`mwheel-scroll-down-function' to
`doc-view-scroll-down-or-previous-page'.
Diffstat (limited to 'lisp/mwheel.el')
-rw-r--r-- | lisp/mwheel.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/mwheel.el b/lisp/mwheel.el index ad500443b3e..a303fcf78d7 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -179,6 +179,12 @@ This can be slightly disconcerting, but some people prefer it." (if (eq (event-basic-type last-input-event) mouse-wheel-click-event) (setq this-command 'ignore))) +(defvar mwheel-scroll-up-function 'scroll-up + "Function that does the job of scrolling upward.") + +(defvar mwheel-scroll-down-function 'scroll-down + "Function that does the job of scrolling downward.") + (defun mwheel-scroll (event) "Scroll up or down according to the EVENT. This should only be bound to mouse buttons 4 and 5." @@ -206,12 +212,12 @@ This should only be bound to mouse buttons 4 and 5." (unwind-protect (let ((button (mwheel-event-button event))) (cond ((eq button mouse-wheel-down-event) - (condition-case nil (scroll-down amt) + (condition-case nil (funcall mwheel-scroll-down-function amt) ;; Make sure we do indeed scroll to the beginning of ;; the buffer. (beginning-of-buffer (unwind-protect - (scroll-down) + (funcall mwheel-scroll-down-function) ;; If the first scroll succeeded, then some scrolling ;; is possible: keep scrolling til the beginning but ;; do not signal an error. For some reason, we have @@ -221,9 +227,9 @@ This should only be bound to mouse buttons 4 and 5." ;; to only affect scroll-down. --Stef (set-window-start (selected-window) (point-min)))))) ((eq button mouse-wheel-up-event) - (condition-case nil (scroll-up amt) + (condition-case nil (funcall mwheel-scroll-up-function amt) ;; Make sure we do indeed scroll to the end of the buffer. - (end-of-buffer (while t (scroll-up))))) + (end-of-buffer (while t (funcall mwheel-scroll-up-function))))) (t (error "Bad binding in mwheel-scroll")))) (if curwin (select-window curwin))) ;; If there is a temporarily active region, deactivate it iff |