Try counsel-file-jump before project-find-file-in

The former is more reliable (and faster, with the fd/rg hack in the next
commit).

Also (hopefully) fixes the "cl-no-applicable-method: No applicable
method: project-roots" error emitted when project-find-file-in fails to
identify the target as a project root.
This commit is contained in:
Henrik Lissner 2019-08-06 19:42:05 -04:00
parent 3ec66b7c1c
commit 29e851da27
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -110,14 +110,16 @@ If DIR is not a project, it will be indexed (but not cached)."
(setq projectile-enable-caching nil)) (setq projectile-enable-caching nil))
(call-interactively (call-interactively
;; Intentionally avoid `helm-projectile-find-file', because it runs ;; Intentionally avoid `helm-projectile-find-file', because it runs
;; asynchronously, and thus doesn't see the lexical `default-directory' ;; asynchronously, and thus doesn't see the lexical
;; `default-directory'
(if (doom-module-p :completion 'ivy) (if (doom-module-p :completion 'ivy)
#'counsel-projectile-find-file #'counsel-projectile-find-file
#'projectile-find-file))) #'projectile-find-file)))
((fboundp 'project-find-file-in) ; emacs 26.1+ only
(project-find-file-in nil (list default-directory) nil))
((fboundp 'counsel-file-jump) ; ivy only ((fboundp 'counsel-file-jump) ; ivy only
(call-interactively #'counsel-file-jump)) (call-interactively #'counsel-file-jump))
((and (fboundp 'project-find-file-in) ; emacs 26.1+ only
(project-current))
(project-find-file-in nil (list default-directory) nil))
((fboundp 'helm-find-files) ((fboundp 'helm-find-files)
(call-interactively #'helm-find-files)) (call-interactively #'helm-find-files))
((call-interactively #'find-file))))) ((call-interactively #'find-file)))))