about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-minibuffer.el
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2021-09-03 07:35:31 +0100
committerDavid Morgan <djm_uk@protonmail.com>2021-09-03 07:35:31 +0100
commitec0a75ec27d4c93971222c331cd05caa9a6d29b3 (patch)
tree94fe1ce7e5aec6b7e0e7c1c78a9347068e27061f /.emacs.d/lisp/init-minibuffer.el
parentceafcdc42d84c10ec6070537fb1d5d465bc29bdb (diff)
downloaddotfiles-ec0a75ec27d4c93971222c331cd05caa9a6d29b3.tar.gz
Reorder consult--source vars to get recentf behaviour with perspective narrowing
Diffstat (limited to '.emacs.d/lisp/init-minibuffer.el')
-rw-r--r--.emacs.d/lisp/init-minibuffer.el29
1 files changed, 15 insertions, 14 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
index 75be3cc..4209628 100644
--- a/.emacs.d/lisp/init-minibuffer.el
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -272,20 +272,6 @@
   (when (and (eq system-type 'darwin) (string-match-p "^find" consult-find-args))
     (setq consult-find-args (concat "g" consult-find-args)))
 
-  ;; Use fd that that we aren't just getting recentf, but also respect .gitignore
-  (setq consult--source-project-file
-        (plist-put consult--source-project-file
-                   :items '(lambda ()
-                             (when-let (root (consult--project-root))
-                               (let ((len (length root))
-                                     (inv-root (propertize root 'invisible t)))
-                                 (mapcar (lambda (x)
-                                           (concat inv-root (substring x len)))
-                                         (split-string
-                                          (shell-command-to-string
-                                           (format  "fd --color never -t f -0 . %s" root))
-                                          "\0" t)))))))
-
   (defvar consult--source-perspective-buffer
     `(:name     "Perspective Buffer"
                 :narrow   (?x . "Perspective")
@@ -304,10 +290,25 @@
   (add-to-list 'consult-buffer-sources 'consult--source-perspective-buffer t)
 
   ;; Copy of consult--source-project-file to use with perspective narrowing (identical except for narrowing key)
+  ;; Put before consult--source-project-file so we get recentf behaviour here
   (defvar consult--source-perspective-files
     (plist-put (copy-sequence  consult--source-project-file) :narrow '(?x "Project Files")))
   (add-to-list 'consult-buffer-sources 'consult--source-perspective-files t)
 
+  ;; Use fd that that we aren't just getting recentf, but also respect .gitignore
+  (setq consult--source-project-file
+        (plist-put consult--source-project-file
+                   :items '(lambda ()
+                             (when-let (root (consult--project-root))
+                               (let ((len (length root))
+                                     (inv-root (propertize root 'invisible t)))
+                                 (mapcar (lambda (x)
+                                           (concat inv-root (substring x len)))
+                                         (split-string
+                                          (shell-command-to-string
+                                           (format  "fd --color never -t f -0 . %s" root))
+                                          "\0" t)))))))
+
   ;; Versions of consult--source-project-buffer and consult--source-project-file for use by consult-project-buffer
   ;; They allow narrowing with b and f (instead of p)
   (defvar consult--project-source-project-buffer