doom-project-find-file: avoid helm-projectile #1274
helm-projectile-find-file misbehaves as a workspace project-switch handler (likely because it runs asynchronously and misses the lexical value of `default-directory`), so we avoid it and use projectile-find-file directly (which still uses helm, just not the helm-projectile package).
This commit is contained in:
parent
379c01ba1e
commit
c2d0cae6a5
1 changed files with 15 additions and 10 deletions
|
@ -86,19 +86,24 @@ they are absolute."
|
|||
;;;###autoload
|
||||
(defun doom-project-find-file (dir)
|
||||
"Fuzzy-find a file under DIR."
|
||||
(without-project-cache!
|
||||
(let* ((default-directory (file-truename dir))
|
||||
(unless (file-directory-p dir)
|
||||
(error "Directory %S does not exist" dir))
|
||||
(let ((default-directory dir)
|
||||
projectile-project-root)
|
||||
(call-interactively
|
||||
;; completion modules may remap this command
|
||||
(or (command-remapping #'projectile-find-file)
|
||||
#'projectile-find-file)))))
|
||||
;; Intentionally avoid `helm-projectile-find-file', because it runs
|
||||
;; asynchronously, and thus doesn't see the lexical `default-directory'
|
||||
(if (featurep! :completion ivy)
|
||||
#'counsel-projectile-find-file
|
||||
#'projectile-find-file))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-project-browse (dir)
|
||||
"Traverse a file structure starting linearly from DIR."
|
||||
(let ((default-directory (file-truename dir)))
|
||||
(call-interactively
|
||||
;; completion modules may remap this command
|
||||
(or (command-remapping #'find-file)
|
||||
#'find-file))))
|
||||
(cond ((featurep! :completion ivy)
|
||||
#'counsel-find-file)
|
||||
((featurep! :completion helm)
|
||||
#'helm-find-files)
|
||||
(#'find-file)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue