Make denote-grep-files-referenced-in-region throw an error if there is no active region

This commit is contained in:
Protesilaos Stavrou 2025-04-15 08:42:39 +03:00
parent 146e620417
commit 5193b10b25
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -5431,7 +5431,12 @@ just the identifier (as described in `denote-link' and related), links
written by an Org dynamic block (see the `denote-org' package), or even
file listings such as those of `dired' and the command-line `ls' program."
(interactive
(list (denote-grep-query-prompt :region) (region-beginning) (region-end)))
(if (region-active-p)
(list
(denote-grep-query-prompt :region)
(region-beginning)
(region-end))
(user-error "No region is active; aborting")))
(if-let* ((files (denote-grep--get-files-referenced-in-region start end)))
(denote-make-links-buffer query files nil denote-grep-display-buffer-action)
(user-error "No files referenced in region")))