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

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

[elpa] externals/consult 1b54727a07: Introduce hidden project buffer sou


From: ELPA Syncer
Subject: [elpa] externals/consult 1b54727a07: Introduce hidden project buffer sources (Fix #776)
Date: Sun, 26 Mar 2023 15:57:40 -0400 (EDT)

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

    Introduce hidden project buffer sources (Fix #776)
---
 CHANGELOG.org |  4 ++++
 consult.el    | 28 +++++++++++++++-------------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index 3372501c81..754fb9ffbf 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -10,6 +10,10 @@
   in =consult-buffer= and =consult-recent-file=. This ensures that 
abbreviation does
   not access the file system (or worse remote hosts via Tramp) and is always
   fast. The downside is that some paths may not get abbreviated.
+- Introduce buffer sources =consult--source-project-buffer-hidden= and
+  =consult--source-project-recent-file-hidden=. Set the buffer sources of
+  =consult-project= to =consult--source-project-buffer= and
+  =consult--source-project-recent-file= to ease customization.
 
 * Version 0.33 (2023-03-11)
 
diff --git a/consult.el b/consult.el
index cb6d8dddda..bca091a43d 100644
--- a/consult.el
+++ b/consult.el
@@ -217,14 +217,16 @@ character, the *Completions* buffer and a few log 
buffers."
     consult--source-recent-file
     consult--source-file-register
     consult--source-bookmark
-    consult--source-project-buffer
-    consult--source-project-recent-file)
+    consult--source-project-buffer-hidden
+    consult--source-project-recent-file-hidden)
   "Sources used by `consult-buffer'.
 See also `consult-project-buffer-sources'.
 See `consult--multi' for a description of the source data structure."
   :type '(repeat symbol))
 
-(defcustom consult-project-buffer-sources nil
+(defcustom consult-project-buffer-sources
+  '(consult--source-project-buffer
+    consult--source-project-recent-file)
   "Sources used by `consult-project-buffer'.
 See also `consult-buffer-sources'.
 See `consult--multi' for a description of the source data structure."
@@ -4440,8 +4442,7 @@ If NORECORD is non-nil, do not record the buffer switch 
in the buffer list."
 
 (defvar consult--source-project-buffer
   `(:name     "Project Buffer"
-    :narrow   (?p . "Project")
-    :hidden   t
+    :narrow   ?b
     :category buffer
     :face     consult-buffer
     :history  buffer-name-history
@@ -4457,8 +4458,7 @@ If NORECORD is non-nil, do not record the buffer switch 
in the buffer list."
 
 (defvar consult--source-project-recent-file
   `(:name     "Project File"
-    :narrow   (?p . "Project")
-    :hidden   t
+    :narrow   ?f
     :category file
     :face     consult-file
     :history  file-name-history
@@ -4491,6 +4491,14 @@ If NORECORD is non-nil, do not record the buffer switch 
in the buffer list."
                  (push part items))))))))
   "Project file candidate source for `consult-buffer'.")
 
+(defvar consult--source-project-buffer-hidden
+  `(:hidden t :narrow (?p . "Project") ,@consult--source-project-buffer)
+  "Like `consult--source-project-buffer' but hidden by default.")
+
+(defvar consult--source-project-recent-file-hidden
+  `(:hidden t :narrow (?p . "Project") ,@consult--source-project-recent-file)
+  "Like `consult--source-project-recent-file' but hidden by default.")
+
 (defvar consult--source-hidden-buffer
   `(:name     "Hidden Buffer"
     :narrow   ?\s
@@ -4595,12 +4603,6 @@ configuration of the virtual buffer sources."
     (unless (plist-get (cdr selected) :match)
       (consult--buffer-action (car selected)))))
 
-;; Populate `consult-project-buffer-sources'.
-(setq consult-project-buffer-sources
-      (list
-       `(:hidden nil :narrow ?b ,@consult--source-project-buffer)
-       `(:hidden nil :narrow ?f ,@consult--source-project-recent-file)))
-
 (defmacro consult--with-project (&rest body)
   "Ensure that BODY is executed with a project root."
   ;; We have to work quite hard here to ensure that the project root is



reply via email to

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