summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2024-07-02 12:11:39 +0200
committerAlan Pearce2024-07-02 12:11:39 +0200
commit573457f40c06a867f9613872ab41b43e61ed81f1 (patch)
tree89c457dbdb042e932d001cbcb91f6ad8785dfe72 /user/emacs
parent83be0be9d001b092bbce4c1b7273a4e6d92b0e3b (diff)
downloadnixfiles-573457f40c06a867f9613872ab41b43e61ed81f1.tar.lz
nixfiles-573457f40c06a867f9613872ab41b43e61ed81f1.tar.zst
nixfiles-573457f40c06a867f9613872ab41b43e61ed81f1.zip
emacs: avoid duplicate project.el entries
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index c2a53334..45054237 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -997,13 +997,21 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :config (progn
             (treemacs-load-theme "simple")))
 
+(defun ap/consult-ghq-switch-project (dir)
+  "Append a slash to avoid project.el remembering two different
+paths for the same project."
+  (interactive)
+  (project-switch-project (if (string-suffix-p "/" dir)
+                              dir
+                            (concat dir "/"))))
 (use-package consult-ghq
   :defer 5
   :general (:keymaps 'project-prefix-map
                      "o" #'consult-ghq-switch-project)
   :config (progn
             (setq consult-ghq-grep-function #'consult-grep
-                  consult-ghq-find-function #'consult-find)))
+                  consult-ghq-find-function #'consult-find
+                  consult-ghq-switch-project-function #'ap/consult-ghq-switch-project)))
 
 (use-package envrc
   :defer 2