emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/doc-view.el


From: Juri Linkov
Subject: [Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/doc-view.el
Date: Mon, 23 Nov 2009 20:34:58 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     09/11/23 20:34:57

Modified files:
        etc            : NEWS 
        lisp           : ChangeLog doc-view.el 

Log message:
        Implement DocView Continuous mode.  (Bug#4896)
        * doc-view.el (doc-view-continuous-mode): New defcustom.
        (doc-view-mode-map): Bind C-n/<down> to 
`doc-view-next-line-or-next-page',
        C-p/<up> to `doc-view-previous-line-or-previous-page'.
        (doc-view-next-line-or-next-page)
        (doc-view-previous-line-or-previous-page): New commands.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/etc/NEWS?cvsroot=emacs&r1=1.2122&r2=1.2123
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16708&r2=1.16709
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/doc-view.el?cvsroot=emacs&r1=1.88&r2=1.89

Patches:
Index: etc/NEWS
===================================================================
RCS file: /sources/emacs/emacs/etc/NEWS,v
retrieving revision 1.2122
retrieving revision 1.2123
diff -u -b -r1.2122 -r1.2123
--- etc/NEWS    23 Nov 2009 20:30:33 -0000      1.2122
+++ etc/NEWS    23 Nov 2009 20:34:53 -0000      1.2123
@@ -192,6 +192,11 @@
 exempt buffers that do correspond to files, customize the value of
 `desktop-files-not-to-save' instead.
 
+** DocView
+
+*** When `doc-view-continuous-mode' is non-nil, scrolling a line
+on the page edge advances to the next/previous page.
+
 ** FIXME mail-user-agent change
 This probably affects a lot of documentation.
 

Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16708
retrieving revision 1.16709
diff -u -b -r1.16708 -r1.16709
--- lisp/ChangeLog      23 Nov 2009 20:31:05 -0000      1.16708
+++ lisp/ChangeLog      23 Nov 2009 20:34:54 -0000      1.16709
@@ -1,5 +1,14 @@
 2009-11-23  Juri Linkov  <address@hidden>
 
+       Implement DocView Continuous mode.  (Bug#4896)
+       * doc-view.el (doc-view-continuous-mode): New defcustom.
+       (doc-view-mode-map): Bind C-n/<down> to 
`doc-view-next-line-or-next-page',
+       C-p/<up> to `doc-view-previous-line-or-previous-page'.
+       (doc-view-next-line-or-next-page)
+       (doc-view-previous-line-or-previous-page): New commands.
+
+2009-11-23  Juri Linkov  <address@hidden>
+
        Implement Isearch in comint input history.  (Bug#3746)
        * comint.el (comint-mode): Add `comint-history-isearch-setup' to
        `isearch-mode-hook'.

Index: lisp/doc-view.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/doc-view.el,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -b -r1.88 -r1.89
--- lisp/doc-view.el    17 Jul 2009 19:43:53 -0000      1.88
+++ lisp/doc-view.el    23 Nov 2009 20:34:57 -0000      1.89
@@ -222,6 +222,15 @@
   :type 'integer
   :group 'doc-view)
 
+(defcustom doc-view-continuous-mode nil
+  "In Continuous mode reaching the page edge advances to 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,6 +295,10 @@
     (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 "<down>")    'doc-view-next-line-or-next-page)
+    (define-key map (kbd "C-p")       'doc-view-previous-line-or-previous-page)
+    (define-key map (kbd "<up>")      '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,6 +455,38 @@
        (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 ()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]