From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#4896: DocView: Continuous mode Date: Mon, 23 Nov 2009 12:07:56 +0100 Message-ID: <87my2dlcs3.fsf@thinkpad.tsdh.de> 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> Reply-To: Tassilo Horn , 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 1258975816 20471 80.91.229.12 (23 Nov 2009 11:30:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2009 11:30:16 +0000 (UTC) Cc: 4896@emacsbugs.donarmstrong.com, Stefan Monnier To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 23 12:30:09 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 1NCX7P-0005Ih-1G for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 12:30:08 +0100 Original-Received: from localhost ([127.0.0.1]:36662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCX7O-0003YV-Dy for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 06:30:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCX4s-0001q7-UX for bug-gnu-emacs@gnu.org; Mon, 23 Nov 2009 06:27:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCX4n-0001nB-TW for bug-gnu-emacs@gnu.org; Mon, 23 Nov 2009 06:27:30 -0500 Original-Received: from [199.232.76.173] (port=37660 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCX4n-0001mj-65 for bug-gnu-emacs@gnu.org; Mon, 23 Nov 2009 06:27:25 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43426) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NCX4m-0003vi-AP for bug-gnu-emacs@gnu.org; Mon, 23 Nov 2009 06:27:24 -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 nANBRL5w028724; Mon, 23 Nov 2009 03:27:22 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id nANBF6f3027267; Mon, 23 Nov 2009 03:15:06 -0800 Resent-Date: Mon, 23 Nov 2009 03:15:06 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Tassilo Horn Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Mon, 23 Nov 2009 11:15:06 +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.125897448126453 (code B ref 4896); Mon, 23 Nov 2009 11:15:06 +0000 Original-Received: (at 4896) by emacsbugs.donarmstrong.com; 23 Nov 2009 11:08:01 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from deliver.uni-koblenz.de (deliver.uni-koblenz.de [141.26.64.15]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nANB7xRs026450 for <4896@emacsbugs.donarmstrong.com>; Mon, 23 Nov 2009 03:08:00 -0800 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 1BFBB78A2C70; Mon, 23 Nov 2009 12:07:59 +0100 (CET) Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05192-07; Mon, 23 Nov 2009 12:07:56 +0100 (CET) X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org Original-Received: from thinkpad.tsdh.de (unknown [141.26.95.131]) by deliver.uni-koblenz.de (Postfix) with ESMTP id A622778A2C5C; Mon, 23 Nov 2009 12:07:56 +0100 (CET) In-Reply-To: <87r5rpindl.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 23 Nov 2009 11:47:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-Virus-Scanned: amavisd-new at uni-koblenz.de X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Mon, 23 Nov 2009 06:27: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:32845 Archived-At: Juri Linkov writes: Hi Juri, > The following patch adds a new variable `doc-view-continuous-mode' and > uses it in two new commands `doc-view-next-line-or-next-page' and > `doc-view-previous-line-or-previous-page'. Looks good to me, except that I have the feeling that this whole "check if scolling happened" thingy could be refactored into its own functions and used from doc-view-scroll-up-or-next-page and doc-view-next-line-or-next-page (and the other two). > 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? Bye, Tassilo > Index: lisp/doc-view.el > =================================================================== > RCS file: /sources/emacs/emacs/lisp/doc-view.el,v > retrieving revision 1.88 > diff -c -r1.88 doc-view.el > *** lisp/doc-view.el 17 Jul 2009 19:43:53 -0000 1.88 > --- lisp/doc-view.el 23 Nov 2009 09:45:37 -0000 > *************** > *** 222,227 **** > --- 222,236 ---- > :type 'integer > :group 'doc-view) > > + (defcustom doc-view-continuous-mode nil > + "In Continuous mode reaching the page edge advances to the next/previous page. > + When non-nil, scrolling a line upward at the bottom edge of the page > + moves to the next page, and scrolling a line downward at the top edge > + of the page moves to the previous page." > + :type 'boolean > + :group 'doc-view > + :version "23.2") > + > ;;;; Internal Variables > > (defun doc-view-new-window-function (winprops) > *************** > *** 286,291 **** > --- 295,304 ---- > (define-key map [remap backward-page] 'doc-view-previous-page) > (define-key map (kbd "SPC") 'doc-view-scroll-up-or-next-page) > (define-key map (kbd "DEL") 'doc-view-scroll-down-or-previous-page) > + (define-key map (kbd "C-n") 'doc-view-next-line-or-next-page) > + (define-key map (kbd "") 'doc-view-next-line-or-next-page) > + (define-key map (kbd "C-p") 'doc-view-previous-line-or-previous-page) > + (define-key map (kbd "") 'doc-view-previous-line-or-previous-page) > (define-key map (kbd "M-<") 'doc-view-first-page) > (define-key map (kbd "M->") 'doc-view-last-page) > (define-key map [remap goto-line] 'doc-view-goto-page) > *************** > *** 442,447 **** > --- 455,492 ---- > (image-bol 1)) > (set-window-hscroll (selected-window) hscroll)))) > > + (defun doc-view-next-line-or-next-page (&optional n) > + "Scroll upward by N lines if possible, else goto next page. > + When `doc-view-continuous-mode' is non-nil, scrolling a line upward at > + the bottom edge of the page moves to the next page." > + (interactive "p") > + (if doc-view-continuous-mode > + (let ((hscroll (window-hscroll)) > + (cur-page (doc-view-current-page))) > + (when (= (window-vscroll) (image-next-line n)) > + (doc-view-next-page) > + (when (/= cur-page (doc-view-current-page)) > + (image-bob) > + (image-bol 1)) > + (set-window-hscroll (selected-window) hscroll))) > + (image-next-line 1))) > + > + (defun doc-view-previous-line-or-previous-page (&optional n) > + "Scroll downward by N lines if possible, else goto previous page. > + When `doc-view-continuous-mode' is non-nil, scrolling a line downward > + at the top edge of the page moves to the previous page." > + (interactive "p") > + (if doc-view-continuous-mode > + (let ((hscroll (window-hscroll)) > + (cur-page (doc-view-current-page))) > + (when (= (window-vscroll) (image-previous-line n)) > + (doc-view-previous-page) > + (when (/= cur-page (doc-view-current-page)) > + (image-eob) > + (image-bol 1)) > + (set-window-hscroll (selected-window) hscroll))) > + (image-previous-line n))) > + > ;;;; Utility Functions > > (defun doc-view-kill-proc ()