From dc3d1c98efeafdc98bec6cfb4c85d589ea042252 Mon Sep 17 00:00:00 2001 From: Adam Plaice Date: Thu, 31 Aug 2017 12:34:52 +0100 Subject: Add scroll-down command and keybinding --- nov.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 "") '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 "") 'beginning-of-buffer) (define-key map (kbd "") '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))) -- cgit v1.2.3