Make 'denote-query' also use the active region

This commit is contained in:
Protesilaos Stavrou 2025-03-24 08:17:28 +02:00
parent 490ad08718
commit 7aaf9be29f
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -5372,13 +5372,13 @@ non-nil value."
;;;###autoload
(defun denote-query (query)
"Create a QUERY link at point.
"Create query link at point, prompting for QUERY or using the active region.
Query links do not point to any file but instead initiate a search in
the contents of files inside the variable `denote-directory'. They are
always formatted as [[denote:QUERY]]. This is unlike what `denote-link'
and related commands do, which always establish a direct connection to a
file and their format is more flexible."
(interactive (list (denote-query-prompt)))
(interactive (list (or (denote--get-active-region-content) (denote-query-prompt))))
(denote--delete-active-region-content)
(insert (format "[[denote:%s]]" query)))