1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-09 05:01:02 -08:00

Handle project--files-in-directory finding no files better

* lisp/progmodes/project.el (project--find-regexp-in-files):
Signal user-error when passed an empty list of files.

* lisp/progmodes/xref.el (xref-matches-in-files):
Make sure FILES is not empty.
This commit is contained in:
Dmitry Gutov 2020-03-30 23:16:03 +03:00
parent 650a664ccd
commit ac3da1dd96
2 changed files with 3 additions and 0 deletions

View file

@ -480,6 +480,8 @@ pattern to search for."
nil)))
(defun project--find-regexp-in-files (regexp files)
(unless files
(user-error "Empty file list"))
(let ((xrefs (xref-matches-in-files regexp files)))
(unless xrefs
(user-error "No matches for: %s" regexp))

View file

@ -1232,6 +1232,7 @@ IGNORES is a list of glob patterns for files to ignore."
"Find all matches for REGEXP in FILES.
Return a list of xref values.
FILES must be a list of absolute file names."
(cl-assert (consp files))
(pcase-let*
((output (get-buffer-create " *project grep output*"))
(`(,grep-re ,file-group ,line-group . ,_) (car grep-regexp-alist))