From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#4896: DocView: Continuous mode Date: Tue, 24 Nov 2009 19:08:09 +0200 Organization: JURTA Message-ID: <877htgyrwy.fsf@mail.jurta.org> References: <87tyx2anec.fsf@mail.jurta.org> <87ocn8i9qn.fsf@mail.jurta.org> <87aayst364.fsf@thinkpad.tsdh.de> <87d43o2dgc.fsf@mail.jurta.org> <871vk3ubwj.fsf@thinkpad.tsdh.de> <87r5rpindl.fsf@mail.jurta.org> <87my2dlcs3.fsf@thinkpad.tsdh.de> <87my2dyzh7.fsf@mail.jurta.org> Reply-To: Juri Linkov , 4896@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259083751 28036 80.91.229.12 (24 Nov 2009 17:29:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Nov 2009 17:29:11 +0000 (UTC) Cc: Tassilo Horn To: 4896@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 24 18:29:02 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NCzCH-0007cd-0G for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Nov 2009 18:29:01 +0100 Original-Received: from localhost ([127.0.0.1]:59293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCzCG-0003pm-K5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Nov 2009 12:29:00 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCzAv-00035i-IR for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2009 12:27:38 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCzAp-00031T-I3 for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2009 12:27:35 -0500 Original-Received: from [199.232.76.173] (port=46272 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCzAp-000312-8L for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2009 12:27:31 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:55392) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NCzAl-0001X9-Mp for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2009 12:27:28 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAOHRL1V003786; Tue, 24 Nov 2009 09:27:25 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id nAOHP8Ds003558; Tue, 24 Nov 2009 09:25:08 -0800 Resent-Date: Tue, 24 Nov 2009 09:25:08 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Juri Linkov Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Tue, 24 Nov 2009 17:25:08 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4896 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4896-submit@emacsbugs.donarmstrong.com id=B4896.12590829412957 (code B ref 4896); Tue, 24 Nov 2009 17:25:08 +0000 Original-Received: (at 4896) by emacsbugs.donarmstrong.com; 24 Nov 2009 17:15:41 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mx1.starman.ee (smtp-out3.starman.ee [85.253.0.5]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAOHFd9l002948 for <4896@emacsbugs.donarmstrong.com>; Tue, 24 Nov 2009 09:15:41 -0800 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.34.225.cable.starman.ee [82.131.34.225]) by mx1.starman.ee (Postfix) with ESMTP id 11C133F411D; Tue, 24 Nov 2009 19:15:33 +0200 (EET) In-Reply-To: <87my2dyzh7.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 23 Nov 2009 22:43:32 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Tue, 24 Nov 2009 12:27:35 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:32881 Archived-At: >>> However, I still have no idea how make the mouse-wheel to jump to the >>> next/previous page depending on the value of >>> `doc-view-continuous-mode'. >> >> Can't you simply bind mouse-4/5 to the two new functions? > > mwheel.el provides many useful settings like `mouse-wheel-scroll-amount' > that we should respect in DocView. `mwheel-scroll' relies on `scroll-up' and `scroll-down' to do its job with the specified values of `mouse-wheel-scroll-amount'. It would be good if it was able to use doc-view scrolling. Below is a proof of concept, not the final patch. It provides the correct behavior of the mouse wheel scrolling in continuous mode. Any ideas how to specify doc-view scrolling functions for mwheel.el in doc-view continuous mode? 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/