branch: externals/embark
commit f313f6323a37bd6090f88960a6650d5d1ec55054
Author: Omar Antolín Camarena <[email protected]>
Commit: Omar Antolín Camarena <[email protected]>
When target has a directory, set consult-project-function=nil
This fixes #641.
---
embark-consult.el | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/embark-consult.el b/embark-consult.el
index 704826c08a..8d8f58bf39 100644
--- a/embark-consult.el
+++ b/embark-consult.el
@@ -214,6 +214,19 @@ This function is meant to be added to
`embark-collect-mode-hook'."
(setf (alist-get 'consult-grep embark-exporters-alist)
#'embark-consult-export-grep)
+(cl-defun embark-consult--projectless
+ (&rest rest &key run target type &allow-other-keys)
+ "Run action with nil `consult-project-function', if TARGET has an directory.
+The values of TYPE which are considered to have an associated
+directory are: file, buffer, bookmark and library. The REST of
+the arguments are also passed to RUN."
+ (when (embark--associated-directory target type)
+ (let (consult-project-function)
+ (apply run :target target :type type rest))))
+
+(cl-pushnew #'embark-consult--projectless
+ (alist-get 'consult-grep embark-around-action-hooks))
+
;;; Support for consult-xref
(declare-function xref--show-xref-buffer "ext:xref")