emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 9b6cf70026 6/9: Add wrapper motions for backlink


From: ELPA Syncer
Subject: [elpa] externals/denote 9b6cf70026 6/9: Add wrapper motions for backlinks' buffer
Date: Wed, 26 Oct 2022 23:57:37 -0400 (EDT)

branch: externals/denote
commit 9b6cf70026d9f8ed464a1503513b6c58b21971fc
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add wrapper motions for backlinks' buffer
    
    With the denote-backlinks-show-context, we now have two types of
    backlinks' buffer: (1) a generic one that uses buttons that we create
    and (2) the familiar Xref buffer.  These commands are meant to
    accommodate both types.
    
    Read the discussion on the mailing list about the refactoring of the
    backlinks' buffer, with the participation of Noboru Ota:
    <https://lists.sr.ht/~protesilaos/denote/%3C86r0yvzm12.fsf%40nobiot.com%3E>.
    
    Also check the recent commit log for the relevant changes, including
    patches from Noboru.
---
 denote.el | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/denote.el b/denote.el
index 0633eda074..978ce9ee7b 100644
--- a/denote.el
+++ b/denote.el
@@ -2599,8 +2599,30 @@ Expand `denote-link-backlinks-display-buffer-action'."
    buf
    `(,@denote-link-backlinks-display-buffer-action)))
 
+(defun denote-backlinks-next (&optional n)
+  "Use appropriate command for forward motion in backlinks buffer.
+With optional N as a numeric argument, move to the Nth button
+from point (relevant when `denote-backlinks-show-context' is
+nil)."
+  (interactive "p" denote-backlinks-mode)
+  (if denote-backlinks-show-context
+      (funcall #'xref-next-line)
+    (funcall #'forward-button n)))
+
+(defun denote-backlinks-prev (&optional n)
+  "Use appropriate command for backward motion in backlinks buffer.
+With optional N as a numeric argument, move to the Nth button
+from point (relevant when `denote-backlinks-show-context' is
+nil)."
+  (interactive "p" denote-backlinks-mode)
+  (if denote-backlinks-show-context
+      (funcall #'xref-prev-line)
+    (funcall #'backward-button n)))
+
 (defvar denote-backlinks-mode-map
   (let ((m (make-sparse-keymap)))
+    (define-key m "n" #'denote-backlinks-next)
+    (define-key m "p" #'denote-backlinks-prev)
     (define-key m "g" #'revert-buffer)
     m)
   "Keymap for `denote-backlinks-mode'.")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]