aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilij Schneidermann <mail@vasilij.de>2017-08-31 20:48:51 +0200
committerGitHub <noreply@github.com>2017-08-31 20:48:51 +0200
commit8f084382678ec5a7a52d25eb11884658f213e147 (patch)
treede965ea9c8a75210150743b8fd0bf6af36475b1b
parentf103fc17513e48fe66966a93696ac732b47acd81 (diff)
parentdc3d1c98efeafdc98bec6cfb4c85d589ea042252 (diff)
Merge pull request #1 from aplaice/master
Add scroll-down command and keybinding
-rw-r--r--nov.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/nov.el b/nov.el
index 06d56a9..38a83af 100644
--- a/nov.el
+++ b/nov.el
@@ -312,6 +312,8 @@ Each alist item consists of the identifier and full path.")
(define-key map (kbd "M-TAB") 'shr-previous-link)
(define-key map (kbd "<backtab>") 'shr-previous-link)
(define-key map (kbd "SPC") 'nov-scroll-up)
+ (define-key map (kbd "S-SPC") 'nov-scroll-down)
+ (define-key map (kbd "DEL") 'nov-scroll-down)
(define-key map (kbd "<home>") 'beginning-of-buffer)
(define-key map (kbd "<end>") 'end-of-buffer)
map))
@@ -496,6 +498,16 @@ the HTML is rendered with `shr-render-region'."
(nov-next-chapter)
(scroll-up arg)))
+(defun nov-scroll-down (arg)
+ "Scroll with `scroll-down' or visit previous chapter if at top."
+ (interactive "P")
+ (if (and (<= (window-start) (point-min))
+ (> nov-documents-index 0))
+ (progn
+ (nov-previous-chapter)
+ (goto-char (point-max)))
+ (scroll-down arg)))
+
(defun nov-visit-relative-file (filename target)
"Visit the document as specified by FILENAME and TARGET."
(let* ((current-path (cdr (aref nov-documents nov-documents-index)))