[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4896: DocView: Continuous mode
From: |
Stefan Monnier |
Subject: |
bug#4896: DocView: Continuous mode |
Date: |
Tue, 24 Nov 2009 14:48:36 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
> Any ideas how to specify doc-view scrolling functions for mwheel.el
> in doc-view continuous mode?
mwheel could introduce mwheel-scroll-up-function and
mwheel-scroll-up-function (with global defaults of scroll-up and
scroll-down, obviously) which doc-view could set buffer-locally.
Or we could rename scroll-up/down to scroll-up/down-internal and let
scroll-up/down obey new scroll-up/down-function hooks.
I guess starting with mwheel-scroll-up/down-function is less invasive.
Stefan
> Index: lisp/mwheel.el
> ===================================================================
> RCS file: /sources/emacs/emacs/lisp/mwheel.el,v
> retrieving revision 1.56
> diff -u -r1.56 mwheel.el
> --- lisp/mwheel.el 12 Sep 2009 19:03:52 -0000 1.56
> +++ lisp/mwheel.el 24 Nov 2009 17:07:28 -0000
> @@ -206,7 +206,10 @@
> (unwind-protect
> (let ((button (mwheel-event-button event)))
> (cond ((eq button mouse-wheel-down-event)
> - (condition-case nil (scroll-down amt)
> + (condition-case nil
> + (if (eq major-mode 'doc-view-mode)
> + (doc-view-scroll-down-or-previous-page amt)
> + (scroll-down amt))
> ;; Make sure we do indeed scroll to the beginning of
> ;; the buffer.
> (beginning-of-buffer
> @@ -221,7 +224,10 @@
> ;; 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
> + (if (eq major-mode 'doc-view-mode)
> + (doc-view-scroll-up-or-next-page amt)
> + (scroll-up amt))
> ;; Make sure we do indeed scroll to the end of the buffer.
> (end-of-buffer (while t (scroll-up)))))
> (t (error "Bad binding in mwheel-scroll"))))
> Index: lisp/doc-view.el
> ===================================================================
> RCS file: /sources/emacs/emacs/lisp/doc-view.el,v
> retrieving revision 1.90
> diff -u -r1.90 doc-view.el
> --- lisp/doc-view.el 24 Nov 2009 07:47:49 -0000 1.90
> +++ lisp/doc-view.el 24 Nov 2009 17:07:00 -0000
> @@ -431,24 +431,24 @@
> (interactive)
> (doc-view-goto-page (length doc-view-current-files)))
> -(defun doc-view-scroll-up-or-next-page ()
> +(defun doc-view-scroll-up-or-next-page (&optional n)
> "Scroll page up if possible, else goto next page."
> - (interactive)
> + (interactive "^P")
> (let ((hscroll (window-hscroll))
> (cur-page (doc-view-current-page)))
> - (when (= (window-vscroll) (image-scroll-up nil))
> + (when (= (window-vscroll) (image-scroll-up n))
> (doc-view-next-page)
> (when (/= cur-page (doc-view-current-page))
> (image-bob)
> (image-bol 1))
> (set-window-hscroll (selected-window) hscroll))))
> -(defun doc-view-scroll-down-or-previous-page ()
> +(defun doc-view-scroll-down-or-previous-page (&optional n)
> "Scroll page down if possible, else goto previous page."
> - (interactive)
> + (interactive "^P")
> (let ((hscroll (window-hscroll))
> (cur-page (doc-view-current-page)))
> - (when (= (window-vscroll) (image-scroll-down nil))
> + (when (= (window-vscroll) (image-scroll-down n))
> (doc-view-previous-page)
> (when (/= cur-page (doc-view-current-page))
> (image-eob)
> --
> Juri Linkov
> http://www.jurta.org/emacs/
- bug#4896: DocView: Continuous mode, (continued)
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/12
- bug#4896: DocView: Continuous mode, Tassilo Horn, 2009/11/12
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/12
- bug#4896: DocView: Continuous mode, Tassilo Horn, 2009/11/12
- bug#4896: DocView: Continuous mode, Stefan Monnier, 2009/11/12
- bug#4896: DocView: Continuous mode, Tassilo Horn, 2009/11/12
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/23
- bug#4896: DocView: Continuous mode, Tassilo Horn, 2009/11/23
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/23
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/24
- bug#4896: DocView: Continuous mode,
Stefan Monnier <=
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/25
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/28
- Message not available
- bug#4896: DocView: Continuous mode, Tassilo Horn, 2009/11/29
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/29
- bug#4896: DocView: Continuous mode, Tassilo Horn, 2009/11/29
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/29
- bug#4896: DocView: Continuous mode, Tassilo Horn, 2009/11/30
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/30
- bug#4896: DocView: Continuous mode, Tassilo Horn, 2009/11/30
- bug#4896: DocView: Continuous mode, Juri Linkov, 2009/11/30