aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2009-11-23 20:34:53 +0000
committerJuri Linkov2009-11-23 20:34:53 +0000
commitaefcadb650ddaa4d2ad1737baadf4400c99ba405 (patch)
tree5546070f974596c57cdf92f11ffe1ec88e732942
parent0d62bcea27b6e413bfa3ad14b96f289bb65fcc5e (diff)
downloademacs-aefcadb650ddaa4d2ad1737baadf4400c99ba405.tar.gz
emacs-aefcadb650ddaa4d2ad1737baadf4400c99ba405.zip
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.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/doc-view.el45
3 files changed, 59 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 27f3b9868d8..51c3ee62a60 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -192,6 +192,11 @@ effective for buffers that have no associated file. If you want to
192exempt buffers that do correspond to files, customize the value of 192exempt buffers that do correspond to files, customize the value of
193`desktop-files-not-to-save' instead. 193`desktop-files-not-to-save' instead.
194 194
195** DocView
196
197*** When `doc-view-continuous-mode' is non-nil, scrolling a line
198on the page edge advances to the next/previous page.
199
195** FIXME mail-user-agent change 200** FIXME mail-user-agent change
196This probably affects a lot of documentation. 201This probably affects a lot of documentation.
197 202
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 96573b7508e..1ab6ac35ebc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,14 @@
12009-11-23 Juri Linkov <juri@jurta.org> 12009-11-23 Juri Linkov <juri@jurta.org>
2 2
3 Implement DocView Continuous mode. (Bug#4896)
4 * doc-view.el (doc-view-continuous-mode): New defcustom.
5 (doc-view-mode-map): Bind C-n/<down> to `doc-view-next-line-or-next-page',
6 C-p/<up> to `doc-view-previous-line-or-previous-page'.
7 (doc-view-next-line-or-next-page)
8 (doc-view-previous-line-or-previous-page): New commands.
9
102009-11-23 Juri Linkov <juri@jurta.org>
11
3 Implement Isearch in comint input history. (Bug#3746) 12 Implement Isearch in comint input history. (Bug#3746)
4 * comint.el (comint-mode): Add `comint-history-isearch-setup' to 13 * comint.el (comint-mode): Add `comint-history-isearch-setup' to
5 `isearch-mode-hook'. 14 `isearch-mode-hook'.
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 3ea4fcecfde..afb2e48b145 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -222,6 +222,15 @@ has finished."
222 :type 'integer 222 :type 'integer
223 :group 'doc-view) 223 :group 'doc-view)
224 224
225(defcustom doc-view-continuous-mode nil
226 "In Continuous mode reaching the page edge advances to next/previous page.
227When non-nil, scrolling a line upward at the bottom edge of the page
228moves to the next page, and scrolling a line downward at the top edge
229of the page moves to the previous page."
230 :type 'boolean
231 :group 'doc-view
232 :version "23.2")
233
225;;;; Internal Variables 234;;;; Internal Variables
226 235
227(defun doc-view-new-window-function (winprops) 236(defun doc-view-new-window-function (winprops)
@@ -286,6 +295,10 @@ Can be `dvi', `pdf', or `ps'.")
286 (define-key map [remap backward-page] 'doc-view-previous-page) 295 (define-key map [remap backward-page] 'doc-view-previous-page)
287 (define-key map (kbd "SPC") 'doc-view-scroll-up-or-next-page) 296 (define-key map (kbd "SPC") 'doc-view-scroll-up-or-next-page)
288 (define-key map (kbd "DEL") 'doc-view-scroll-down-or-previous-page) 297 (define-key map (kbd "DEL") 'doc-view-scroll-down-or-previous-page)
298 (define-key map (kbd "C-n") 'doc-view-next-line-or-next-page)
299 (define-key map (kbd "<down>") 'doc-view-next-line-or-next-page)
300 (define-key map (kbd "C-p") 'doc-view-previous-line-or-previous-page)
301 (define-key map (kbd "<up>") 'doc-view-previous-line-or-previous-page)
289 (define-key map (kbd "M-<") 'doc-view-first-page) 302 (define-key map (kbd "M-<") 'doc-view-first-page)
290 (define-key map (kbd "M->") 'doc-view-last-page) 303 (define-key map (kbd "M->") 'doc-view-last-page)
291 (define-key map [remap goto-line] 'doc-view-goto-page) 304 (define-key map [remap goto-line] 'doc-view-goto-page)
@@ -442,6 +455,38 @@ Can be `dvi', `pdf', or `ps'.")
442 (image-bol 1)) 455 (image-bol 1))
443 (set-window-hscroll (selected-window) hscroll)))) 456 (set-window-hscroll (selected-window) hscroll))))
444 457
458(defun doc-view-next-line-or-next-page (&optional n)
459 "Scroll upward by N lines if possible, else goto next page.
460When `doc-view-continuous-mode' is non-nil, scrolling a line upward at
461the bottom edge of the page moves to the next page."
462 (interactive "p")
463 (if doc-view-continuous-mode
464 (let ((hscroll (window-hscroll))
465 (cur-page (doc-view-current-page)))
466 (when (= (window-vscroll) (image-next-line n))
467 (doc-view-next-page)
468 (when (/= cur-page (doc-view-current-page))
469 (image-bob)
470 (image-bol 1))
471 (set-window-hscroll (selected-window) hscroll)))
472 (image-next-line 1)))
473
474(defun doc-view-previous-line-or-previous-page (&optional n)
475 "Scroll downward by N lines if possible, else goto previous page.
476When `doc-view-continuous-mode' is non-nil, scrolling a line downward
477at the top edge of the page moves to the previous page."
478 (interactive "p")
479 (if doc-view-continuous-mode
480 (let ((hscroll (window-hscroll))
481 (cur-page (doc-view-current-page)))
482 (when (= (window-vscroll) (image-previous-line n))
483 (doc-view-previous-page)
484 (when (/= cur-page (doc-view-current-page))
485 (image-eob)
486 (image-bol 1))
487 (set-window-hscroll (selected-window) hscroll)))
488 (image-previous-line n)))
489
445;;;; Utility Functions 490;;;; Utility Functions
446 491
447(defun doc-view-kill-proc () 492(defun doc-view-kill-proc ()