emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/consult 49bbd6a548: README: Simplify configuration exam


From: ELPA Syncer
Subject: [elpa] externals/consult 49bbd6a548: README: Simplify configuration example, add project support section
Date: Mon, 15 Jul 2024 15:57:45 -0400 (EDT)

branch: externals/consult
commit 49bbd6a548f0b91b54106cc246fd2fd98d65ffe5
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    README: Simplify configuration example, add project support section
---
 README.org | 55 ++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 34 insertions(+), 21 deletions(-)

diff --git a/README.org b/README.org
index 5aaf96f34d..25beb14802 100644
--- a/README.org
+++ b/README.org
@@ -258,11 +258,10 @@ their descriptions.
   literally, escape the space with a backslash. The =filter-string= is passed 
to
   the /fast/ Emacs filtering to further narrow down the list of matches. This 
is
   particularly useful if you are using an advanced completion style like
-  orderless. =consult-grep= supports preview. If the =consult-project-function=
-  returns non-nil, =consult-grep= searches the current project directory.
-  Otherwise the =default-directory= is searched. If =consult-grep= is invoked
-  with prefix argument =C-u M-s g=, you can specify one or more 
comma-separated files
-  and directories manually.
+  orderless. =consult-grep= supports preview. =consult-grep= searches the 
current
+  [[#project-support][project directory]] if a project is found. Otherwise the 
=default-directory= is
+  searched. If =consult-grep= is invoked with prefix argument =C-u M-s g=, you 
can
+  specify one or more comma-separated files and directories manually.
 - =consult-find=, =consult-fd=, =consult-locate=: Find file by matching the 
path
   against a regexp. Like for =consult-grep=, either the project root or the
   current directory is the root directory for the search. The input string is
@@ -764,7 +763,7 @@ configuration examples.
 #+begin_src emacs-lisp
 ;; Example configuration for Consult
 (use-package consult
-  ;; Replace bindings. Lazily loaded due by `use-package'.
+  ;; Replace bindings. Lazily loaded by `use-package'.
   :bind (;; C-c bindings in `mode-specific-map'
          ("C-c M-x" . consult-mode-command)
          ("C-c h" . consult-history)
@@ -865,21 +864,7 @@ configuration examples.
 
   ;; Optionally make narrowing help available in the minibuffer.
   ;; You may want to use `embark-prefix-help-command' or which-key instead.
-  ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") 
#'consult-narrow-help)
-
-  ;; By default `consult-project-function' uses `project-root' from project.el.
-  ;; Optionally configure a different project root function.
-  ;;;; 1. project.el (the default)
-  ;; (setq consult-project-function #'consult--default-project--function)
-  ;;;; 2. vc.el (vc-root-dir)
-  ;; (setq consult-project-function (lambda (_) (vc-root-dir)))
-  ;;;; 3. locate-dominating-file
-  ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." 
".git")))
-  ;;;; 4. projectile.el (projectile-project-root)
-  ;; (autoload 'projectile-project-root "projectile")
-  ;; (setq consult-project-function (lambda (_) (projectile-project-root)))
-  ;;;; 5. No project support
-  ;; (setq consult-project-function nil)
+  ;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") 
#'consult-narrow-help)
 )
 #+end_src
 
@@ -938,6 +923,34 @@ an overview of all Consult variables and functions with 
their descriptions.
 | consult-widen-key                | Widening key during completion            
          |
 | consult-yank-rotate              | Rotate kill ring                          
          |
 
+** Project support
+:properties:
+:description: Project discovery support for search commands
+:custom_id: project-support
+:end:
+
+Multiple Consult search commands like =consult-grep= try to discover the 
current
+project and search in the project top level directory by default, if a project
+is found. Otherwise they fall back to the =default-directory=. By default, 
Consult
+uses the Emacs built-in project discovery support (=project-current= and
+=project-root=). It is possible to configure alternative methods via the
+customization variable =consult-project-function=.
+
+#+begin_src emacs-lisp
+;; Optionally configure a different project root function.
+;; 1. project.el (the default)
+(setq consult-project-function #'consult--default-project--function)
+;; 2. vc.el (vc-root-dir)
+(setq consult-project-function (lambda (_) (vc-root-dir)))
+;; 3. locate-dominating-file
+(setq consult-project-function (lambda (_) (locate-dominating-file "." 
".git")))
+;; 4. projectile.el (projectile-project-root)
+(autoload 'projectile-project-root "projectile")
+(setq consult-project-function (lambda (_) (projectile-project-root)))
+;; 5. Disable project support
+(setq consult-project-function nil)
+#+end_src
+
 ** Fine-tuning of individual commands
 :properties:
 :alt_title: Fine-tuning



reply via email to

[Prev in Thread] Current Thread [Next in Thread]