diff options
author | Martin Polden <mpolden@mpolden.no> | 2023-05-27 18:26:16 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2023-05-27 18:26:16 +0200 |
commit | bca448c87d95ef1478443d103797dd28264faa5d (patch) | |
tree | ee8ae7204893a6edc5bc595bbc46403a70064264 /lisp | |
parent | 5b8cc5c6dbef5093769bf7588d2a59a13c8c4337 (diff) |
vertico: ignore remote projects in consult-buffer
Prevents consult-buffer from hanging on dead TRAMP connections.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-vertico.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/init-vertico.el b/lisp/init-vertico.el index 690587e..1156c24 100644 --- a/lisp/init-vertico.el +++ b/lisp/init-vertico.el @@ -2,6 +2,16 @@ ;;; Commentary: ;;; Code: +(defun mpolden/consult-project-function (may-prompt) + "Return project root directory. +When no project is found and MAY-PROMPT is non-nil ask the user. + +This wraps `consult--default-project-function', but ignores +remote projects." + ;; https://github.com/minad/consult/issues/792 + (unless (file-remote-p default-directory) + (consult--default-project-function may-prompt))) + ;; save minibuffer history so that vertico can use it for sorting (use-package savehist :config @@ -11,6 +21,7 @@ (use-package consult :ensure t :init + (setq consult-project-function #'mpolden/consult-project-function) (setq xref-show-xrefs-function #'consult-xref) :bind (("C-x b" . consult-buffer) ("C-c i" . consult-imenu) |