From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#4896: DocView: Continuous mode Date: Tue, 24 Nov 2009 14:48:36 -0500 Message-ID: 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> <877htgyrwy.fsf@mail.jurta.org> Reply-To: Stefan Monnier , 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 1259093337 28304 80.91.229.12 (24 Nov 2009 20:08:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Nov 2009 20:08:57 +0000 (UTC) Cc: 4896@emacsbugs.donarmstrong.com, Tassilo Horn To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 24 21:08:50 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 1ND1gt-0006qF-NH for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Nov 2009 21:08:48 +0100 Original-Received: from localhost ([127.0.0.1]:53033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ND1gt-0004a8-9T for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Nov 2009 15:08:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ND1ff-00041i-Bd for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2009 15:07:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ND1fa-0003yX-85 for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2009 15:07:30 -0500 Original-Received: from [199.232.76.173] (port=42467 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ND1fa-0003yQ-0i for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2009 15:07:26 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:48490) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ND1fZ-0001fc-Hu for bug-gnu-emacs@gnu.org; Tue, 24 Nov 2009 15:07:25 -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 nAOK7M4M018764; Tue, 24 Nov 2009 12:07:22 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id nAOJt59c016997; Tue, 24 Nov 2009 11:55:05 -0800 Resent-Date: Tue, 24 Nov 2009 11:55:05 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Tue, 24 Nov 2009 19:55:05 +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.125909212016545 (code B ref 4896); Tue, 24 Nov 2009 19:55:05 +0000 Original-Received: (at 4896) by emacsbugs.donarmstrong.com; 24 Nov 2009 19:48:40 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from chene.dit.umontreal.ca (chene.dit.umontreal.ca [132.204.246.20]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAOJmbET016542 for <4896@emacsbugs.donarmstrong.com>; Tue, 24 Nov 2009 11:48:39 -0800 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id nAOJma6a005473; Tue, 24 Nov 2009 14:48:36 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 7FA313A1B6; Tue, 24 Nov 2009 14:48:36 -0500 (EST) In-Reply-To: <877htgyrwy.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 24 Nov 2009 19:08:09 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3413=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Tue, 24 Nov 2009 15:07:30 -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:32890 Archived-At: > 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/