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:
Henrik Lissner 2019-03-26 03:38:37 -04:00
parent 379c01ba1e
commit c2d0cae6a5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -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))
projectile-project-root)
(call-interactively
;; completion modules may remap this command
(or (command-remapping #'projectile-find-file)
#'projectile-find-file)))))
(unless (file-directory-p dir)
(error "Directory %S does not exist" dir))
(let ((default-directory dir)
projectile-project-root)
(call-interactively
;; 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)))))