refactor: simplify projectile config
Reverts projectile-project-root-files-bottom-up to its original value, since the absence of those VC entries may surprise folks who aren't new to projectile.
This commit is contained in:
parent
6e1bfe97c0
commit
f5020a4f7f
1 changed files with 18 additions and 19 deletions
|
@ -99,20 +99,16 @@ Is nil if no executable is found in your PATH during startup.")
|
||||||
;;
|
;;
|
||||||
;; In the interest of performance, we reduce the number of project root marker
|
;; In the interest of performance, we reduce the number of project root marker
|
||||||
;; files/directories projectile searches for when resolving the project root.
|
;; files/directories projectile searches for when resolving the project root.
|
||||||
(setq projectile-project-root-files-bottom-up
|
;;
|
||||||
(append '(".projectile" ; projectile's root marker
|
;; These will be filled by other modules. We build this list manually so
|
||||||
".project" ; doom project marker
|
;; projectile doesn't perform so many file checks every time it resolves a
|
||||||
".git") ; Git VCS root dir
|
;; project's root -- particularly when a file has no project.
|
||||||
(when (executable-find "hg")
|
(setq projectile-project-root-files '()
|
||||||
'(".hg")) ; Mercurial VCS root dir
|
|
||||||
(when (executable-find "bzr")
|
|
||||||
'(".bzr"))) ; Bazaar VCS root dir
|
|
||||||
;; This will be filled by other modules. We build this list manually so
|
|
||||||
;; projectile doesn't perform so many file checks every time it resolves
|
|
||||||
;; a project's root -- particularly when a file has no project.
|
|
||||||
projectile-project-root-files '()
|
|
||||||
projectile-project-root-files-top-down-recurring '("Makefile"))
|
projectile-project-root-files-top-down-recurring '("Makefile"))
|
||||||
|
|
||||||
|
;; Adds a more editor/plugin-agnostic project marker.
|
||||||
|
(add-to-list 'projectile-project-root-files-bottom-up ".project")
|
||||||
|
|
||||||
(push (abbreviate-file-name doom-local-dir) projectile-globally-ignored-directories)
|
(push (abbreviate-file-name doom-local-dir) projectile-globally-ignored-directories)
|
||||||
|
|
||||||
;; Per-project compilation buffers
|
;; Per-project compilation buffers
|
||||||
|
@ -122,8 +118,9 @@ Is nil if no executable is found in your PATH during startup.")
|
||||||
;; Support the more generic .project files as an alternative to .projectile
|
;; Support the more generic .project files as an alternative to .projectile
|
||||||
(defadvice! doom--projectile-dirconfig-file-a ()
|
(defadvice! doom--projectile-dirconfig-file-a ()
|
||||||
:override #'projectile-dirconfig-file
|
:override #'projectile-dirconfig-file
|
||||||
(cond ((file-exists-p! (or ".projectile" ".project") (projectile-project-root)))
|
(let ((proot (projectile-project-root)))
|
||||||
((expand-file-name ".project" (projectile-project-root)))))
|
(cond ((file-exists-p! (or projectile-dirconfig-file ".project") proot))
|
||||||
|
((expand-file-name ".project" proot)))))
|
||||||
|
|
||||||
;; Disable commands that won't work, as is, and that Doom already provides a
|
;; Disable commands that won't work, as is, and that Doom already provides a
|
||||||
;; better alternative for.
|
;; better alternative for.
|
||||||
|
@ -168,14 +165,15 @@ c) are not valid projectile projects."
|
||||||
and do (remhash proot projectile-project-type-cache))
|
and do (remhash proot projectile-project-type-cache))
|
||||||
(projectile-serialize-cache))))
|
(projectile-serialize-cache))))
|
||||||
|
|
||||||
;; Some MSYS utilities auto expanded the `/' path separator, so we need to prevent it.
|
;; HACK: Some MSYS utilities auto expanded the `/' path separator, so we need
|
||||||
|
;; to prevent it.
|
||||||
(when doom--system-windows-p
|
(when doom--system-windows-p
|
||||||
(setenv "MSYS_NO_PATHCONV" "1") ; Fix path in Git Bash
|
(setenv "MSYS_NO_PATHCONV" "1") ; Fix path in Git Bash
|
||||||
(setenv "MSYS2_ARG_CONV_EXCL" "--path-separator")) ; Fix path in MSYS2
|
(setenv "MSYS2_ARG_CONV_EXCL" "--path-separator")) ; Fix path in MSYS2
|
||||||
|
|
||||||
;; HACK Don't rely on VCS-specific commands to generate our file lists. That's
|
;; HACK: Don't rely on VCS-specific commands to generate our file lists.
|
||||||
;; 7 commands to maintain, versus the more generic, reliable and
|
;; That's 7 commands to maintain, versus the more generic, reliable, and
|
||||||
;; performant `fd' or `ripgrep'.
|
;; performant `fd' or `ripgrep'.
|
||||||
(defadvice! doom--only-use-generic-command-a (fn vcs)
|
(defadvice! doom--only-use-generic-command-a (fn vcs)
|
||||||
"Only use `projectile-generic-command' for indexing project files.
|
"Only use `projectile-generic-command' for indexing project files.
|
||||||
And if it's a function, evaluate it."
|
And if it's a function, evaluate it."
|
||||||
|
@ -184,7 +182,8 @@ And if it's a function, evaluate it."
|
||||||
(not (file-remote-p default-directory)))
|
(not (file-remote-p default-directory)))
|
||||||
(funcall projectile-generic-command vcs)
|
(funcall projectile-generic-command vcs)
|
||||||
(let ((projectile-git-submodule-command
|
(let ((projectile-git-submodule-command
|
||||||
(get 'projectile-git-submodule-command 'initial-value)))
|
(or projectile-git-submodule-command
|
||||||
|
(get 'projectile-git-submodule-command 'initial-value))))
|
||||||
(funcall fn vcs))))
|
(funcall fn vcs))))
|
||||||
|
|
||||||
;; HACK: `projectile-generic-command' doesn't typically support a function,
|
;; HACK: `projectile-generic-command' doesn't typically support a function,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue