branch: externals/denote-search
commit 7b398fd5fbc82c47c17c4eec40568e39ce155fe5
Author: Grant Rettke <[email protected]>
Commit: Grant Rettke <[email protected]>
Add support for handling `denote-directory-files' returning nil
When calling `denote-search', if the `denote-directory' contains no text
files, Xref previously failed silently. This update improves user experience by
providing a clear explanation when no valid files are found.
---
denote-search.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/denote-search.el b/denote-search.el
index 28334d3644..4c59dd1d8b 100644
--- a/denote-search.el
+++ b/denote-search.el
@@ -238,7 +238,8 @@ The results are populated in a buffer whose major mode is
(xref--analyze
(xref-matches-in-files
query
- (or set (denote-directory-files nil nil :text-only))))))
+ (or set (denote-directory-files nil nil :text-only)
+ (user-error "Sorry, the directory `%s' doesn't have any text
files to search." denote-directory))))))
(or xref-alist (user-error "No matches for `%s'" query))
;; Set internal variables for last set of files and last query
(setq denote-search--last-files nil)