branch: externals/consult-denote commit 4d597df71d6661bb7dfc7482f218eecf6eb22f54 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make consult-denote-grep and consult-denote-find work with list value of denote-directory This builds on top of the new feature that allows the user option 'denote-directory' to accept a list of directories. It was contributed by Jean-Philippe Gagné Guay in pull request 609: <https://github.com/protesilaos/denote/pull/609>. --- consult-denote.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/consult-denote.el b/consult-denote.el index cb8c8860a0..c4d886ae4d 100644 --- a/consult-denote.el +++ b/consult-denote.el @@ -207,14 +207,23 @@ FILE has the same meaning as in `denote-org-extras-outline-prompt'." "Call `consult-denote-grep-command' in the variable `denote-directory'." (declare (interactive-only t)) (interactive) - (funcall-interactively consult-denote-grep-command (denote-directory))) + (if (denote-has-single-denote-directory-p) + (funcall-interactively consult-denote-grep-command (denote-directory)) + (let* ((directories (mapconcat #'identity (denote-directories) " ")) + (consult-grep-args `("grep" (consult--grep-exclude-args) "--null --line-buffered --color=never --ignore-case --with-filename --line-number -I -r" ,directories)) + (consult-ripgrep-args (format "rg --null --line-buffered --color=never --max-columns=1000 --path-separator --smart-case --no-heading --with-filename --line-number --search-zip %s" directories))) + (funcall-interactively consult-denote-grep-command)))) ;;;###autoload (defun consult-denote-find () "Call `consult-denote-find-command' in the variable `denote-directory'." (declare (interactive-only t)) (interactive) - (funcall-interactively consult-denote-find-command (denote-directory))) + (if (denote-has-single-denote-directory-p) + (funcall-interactively consult-denote-find-command (denote-directory)) + (let* ((directories (mapconcat #'identity (denote-directories) " ")) + (consult-find-args (format "find %s -not ( -path */.[A-Za-z]* -prune )" directories))) + (funcall-interactively consult-denote-find-command)))) (consult-customize consult-denote-find :state (consult--file-preview))