Philip Kaludercic: 2
* denote.el (denote-directory): Use 'xdg-user-dir'
Add a major mode for backlink buffers
2 files changed, 13 insertions(+), 2 deletions(-)
* denote.el (denote-backlink-mode-map): Add new map for 'denote-backlink-mode'.
(denote-backlink-mode): Add new mode that derives from 'special-mode'.
(denote-link--prepare-backlinks): Use 'denote-backlink-mode'.
---
denote.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/denote.el b/denote.el
index 0357789..791145a 100644
--- a/denote.el+++ b/denote.el
@@ -1895,6 +1895,16 @@ Expand `denote-link-backlinks-display-buffer-action'."
buf
`(,@denote-link-backlinks-display-buffer-action)))
+(defvar denote-backlink-mode-map+ (let ((m (make-sparse-keymap)))+ (define-key m "n" #'forward-button)+ (define-key m "p" #'backward-button)+ m)+ "Keymap for `denote-backlink-mode'.")++(define-derived-mode denote-backlink-mode special-mode "Backlinks"+ "Major mode for backlinks buffers.")+(defun denote-link--prepare-backlinks (id files &optional title)
"Create backlinks' buffer for ID including FILES.
Use optional TITLE for a prettier heading."
@@ -1903,7 +1913,7 @@ Use optional TITLE for a prettier heading."
(with-current-buffer (get-buffer-create buf)
(setq-local default-directory (denote-directory))
(erase-buffer)
- (special-mode)+ (denote-backlink-mode) (goto-char (point-min))
(when-let* ((title)
(heading (format "Backlinks to %S (%s)" title id))
--
2.37.1