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

    Add error check to query links to ensure they exit if the file type is 
unrecognised
---
 denote.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/denote.el b/denote.el
index 9bf08c61ad..9de275b983 100644
--- a/denote.el
+++ b/denote.el
@@ -5255,6 +5255,9 @@ flexible."
    (list
     (or (denote--get-active-region-content)
         (denote-query-link-prompt nil "Query in file CONTENTS"))))
+  (unless (or (denote--file-type-org-extra-p)
+              (and buffer-file-name (denote-file-has-supported-extension-p 
buffer-file-name)))
+    (user-error "The current file type is not recognized by Denote"))
   (denote--delete-active-region-content)
   (insert (denote--format-query-link 'query-contents query)))
 
@@ -5273,6 +5276,9 @@ flexible."
    (list
     (or (denote--get-active-region-content)
         (denote-query-link-prompt nil "Query in file NAMES"))))
+  (unless (or (denote--file-type-org-extra-p)
+              (and buffer-file-name (denote-file-has-supported-extension-p 
buffer-file-name)))
+    (user-error "The current file type is not recognized by Denote"))
   (denote--delete-active-region-content)
   (insert (denote--format-query-link 'query-filenames query)))
 

Reply via email to