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

    Make function to get query links a variable
    
    This way it can be redefined by other packages, such as
    'denote-search'. Thanks to Lucas Quintana for asking for this addition
    in issue 561: <https://github.com/protesilaos/denote/issues/561>.
---
 denote.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 5d54cc0860..8658982f0e 100644
--- a/denote.el
+++ b/denote.el
@@ -5320,6 +5320,15 @@ concomitant alist, such as 
`denote-backlinks-display-buffer-action'."
                       (denote-make-links-buffer query files-matching-regexp 
buffer-name display-buffer-action)))))
     (display-buffer buffer display-buffer-action)))
 
+(defvar denote-query-links-buffer-function #'denote-make-query-links-buffer
+  "Function to make an Xref buffer showing query link results.
+It accepts two arguments, a query and a `display-buffer' action alist
+like `denote-query-links-display-buffer-action'.")
+
+(defun denote-make-query-links-buffer (query display-buffer-action)
+  "Make a links buffer for QUERY given DISPLAY-BUFFER-ACTION."
+  (denote-make-links-buffer query nil nil display-buffer-action))
+
 (defun denote--backlinks-get-buffer-name (file id)
   "Format a buffer name for `denote-backlinks'.
 Use FILE to detect a suitable title with which to name the buffer.  Else
@@ -5649,7 +5658,7 @@ Uses the function `denote-directory' to establish the 
path to the file."
   (if-let* ((match (denote-link--ol-resolve-link-to-target link))
             (_ (file-exists-p match)))
       (org-link-open-as-file match nil)
-    (denote-make-links-buffer match nil nil 
denote-query-links-display-buffer-action)))
+    (funcall denote-query-links-buffer-function match 
denote-query-links-display-buffer-action)))
 
 ;;;###autoload
 (defun denote-link-ol-complete ()

Reply via email to