diff options
author | Vasilij Schneidermann <mail@vasilij.de> | 2021-12-20 15:09:26 +0100 |
---|---|---|
committer | Vasilij Schneidermann <mail@vasilij.de> | 2021-12-20 15:09:26 +0100 |
commit | 013c2caf882c329714445f3394fff4672e500e08 (patch) | |
tree | f523a4b60b78acd272d91d925ad2101e3ac83601 /nov.el | |
parent | 436f5ec473b69a9d3b6cb6405508e3564f61cd4b (diff) |
Use a dedicated keymap for buttons (thanks, Greg!)
Diffstat (limited to 'nov.el')
-rw-r--r-- | nov.el | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -402,10 +402,6 @@ Each alist item consists of the identifier and full path." (define-key map (kbd "t") 'nov-goto-toc) (define-key map (kbd "l") 'nov-history-back) (define-key map (kbd "r") 'nov-history-forward) - (define-key map (kbd "RET") 'nov-browse-url) - (define-key map (kbd "c") 'nov-copy-url) - (define-key map (kbd "<follow-link>") 'mouse-face) - (define-key map (kbd "<mouse-2>") 'nov-browse-url) (define-key map (kbd "TAB") 'shr-next-link) (define-key map (kbd "M-TAB") 'shr-previous-link) (define-key map (kbd "<backtab>") 'shr-previous-link) @@ -416,6 +412,14 @@ Each alist item consists of the identifier and full path." (define-key map (kbd "<end>") 'end-of-buffer) map)) +(defvar nov-button-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map shr-map) + (define-key map (kbd "RET") 'nov-browse-url) + (define-key map (kbd "<mouse-2>") 'nov-browse-url) + (define-key map (kbd "c") 'nov-copy-url) + map)) + (defun nov-clean-up () "Delete temporary files of the current EPUB buffer." (when nov-temp-dir @@ -509,7 +513,7 @@ chapter title." "Render HTML in current buffer with shr." (run-hooks 'nov-pre-html-render-hook) (let (;; HACK: make buttons use our own commands - (shr-map nov-mode-map) + (shr-map nov-button-map) (shr-external-rendering-functions nov-shr-rendering-functions) (shr-use-fonts nov-variable-pitch)) ;; HACK: `shr-external-rendering-functions' doesn't cover |