branch: externals/denote
commit c3530e1a5e720f35670256bd2275e790f165a965
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Make backlinks motions return user-error outside their buffer
---
 denote.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/denote.el b/denote.el
index 582d035586..49fa618e5c 100644
--- a/denote.el
+++ b/denote.el
@@ -3226,6 +3226,8 @@ 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)
+  (unless (derived-mode-p 'denote-backlinks-mode)
+    (user-error "Only use this in a Denote backlinks buffer"))
   (if denote-backlinks-show-context
       (xref-next-line)
     (forward-button n)))
@@ -3236,6 +3238,8 @@ 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)
+  (unless (derived-mode-p 'denote-backlinks-mode)
+    (user-error "Only use this in a Denote backlinks buffer"))
   (if denote-backlinks-show-context
       (xref-prev-line)
     (backward-button n)))

Reply via email to