Reduce list of root files projectile searches for

And define them on a per-module basis. This reduces the number of file
checks it performs, particularly for non-project files.

Might help #1317
This commit is contained in:
Henrik Lissner 2019-10-19 15:25:29 -04:00
parent e1edbcb3d9
commit 9b25582be1
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
12 changed files with 82 additions and 1 deletions

View file

@ -48,8 +48,27 @@ Emacs.")
:config :config
(projectile-mode +1) (projectile-mode +1)
;; In the interest of performance, we reduce the number of project root marker
;; files/directories projectile searches for when resolving the project root.
(setq projectile-project-root-files-bottom-up
(append '(".project" ; doom project marker
".git") ; Git VCS root dir
(when (executable-find "hg")
'(".hg")) ; Mercurial VCS root dir
(when (executable-find "fossil")
'(".fslckout" ; Fossil VCS root dir
"_FOSSIL_")) ; Fossil VCS root DB on Windows
(when (executable-find "bzr")
'(".bzr")) ; Bazaar VCS root dir
(when (executable-find "darcs")
'("_darcs"))) ; Darcs 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 '("TAGS")
projectile-project-root-files-top-down-recurring '(".svn" "Makefile"))
;; a more generic project root file ;; a more generic project root file
(push ".project" projectile-project-root-files-bottom-up)
(push (abbreviate-file-name doom-local-dir) projectile-globally-ignored-directories) (push (abbreviate-file-name doom-local-dir) projectile-globally-ignored-directories)
;; 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

View file

@ -1,5 +1,12 @@
;;; lang/clojure/config.el -*- lexical-binding: t; -*- ;;; lang/clojure/config.el -*- lexical-binding: t; -*-
(after! projectile
(pushnew! projectile-project-root-files "project.clj" "build.boot" "deps.edn"))
;;
;;; Packages
;;;###package clojure-mode ;;;###package clojure-mode
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode) (add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)

View file

@ -1,5 +1,12 @@
;;; lang/elixir/config.el -*- lexical-binding: t; -*- ;;; lang/elixir/config.el -*- lexical-binding: t; -*-
(after! projectile
(add-to-list 'projectile-project-root-files "mix.exs"))
;;
;;; Packages
(use-package! elixir-mode (use-package! elixir-mode
:defer t :defer t
:init :init

View file

@ -1,5 +1,12 @@
;;; lang/ess/config.el -*- lexical-binding: t; -*- ;;; lang/ess/config.el -*- lexical-binding: t; -*-
(after! projectile
(add-to-list 'projectile-project-root-files "DESCRIPTION"))
;;
;;; Packages
(use-package! ess (use-package! ess
:commands stata SAS :commands stata SAS
:init :init

View file

@ -1,5 +1,8 @@
;;; lang/haskell/config.el -*- lexical-binding: t; -*- ;;; lang/haskell/config.el -*- lexical-binding: t; -*-
(after! projectile
(add-to-list 'projectile-project-root-files "stack.yaml"))
(cond ((featurep! +intero) (load! "+intero")) (cond ((featurep! +intero) (load! "+intero"))
((featurep! +dante) (load! "+dante")) ((featurep! +dante) (load! "+dante"))
((featurep! +lsp) (load! "+lsp"))) ((featurep! +lsp) (load! "+lsp")))

View file

@ -17,6 +17,9 @@ If the depth is 1, the first directory in src/java/net/lissner/game/MyClass.java
is removed: java.net.lissner.game. is removed: java.net.lissner.game.
If the depth is 2, the first two directories are removed: net.lissner.game.") If the depth is 2, the first two directories are removed: net.lissner.game.")
(after! projectile
(pushnew! projectile-project-root-files "gradlew" "build.gradle"))
;; ;;
;; java-mode ;; java-mode

View file

@ -1,5 +1,12 @@
;;; lang/php/config.el -*- lexical-binding: t; -*- ;;; lang/php/config.el -*- lexical-binding: t; -*-
(after! projectile
(add-to-list 'projectile-project-root-files "composer.json"))
;;
;;; Packages
(use-package! php-mode (use-package! php-mode
:mode "\\.inc\\'" :mode "\\.inc\\'"
:config :config

View file

@ -8,6 +8,9 @@ called.")
"CLI arguments to initialize 'jupiter console %s' with when "CLI arguments to initialize 'jupiter console %s' with when
`+python/open-ipython-repl' is called.") `+python/open-ipython-repl' is called.")
(after! projectile
(pushnew! projectile-project-root-files "setup.py" "requirements.txt"))
;; ;;
;; Packages ;; Packages

View file

@ -1,5 +1,12 @@
;;; lang/racket/config.el -*- lexical-binding: t; -*- ;;; lang/racket/config.el -*- lexical-binding: t; -*-
(after! projectile
(add-to-list 'projectile-project-root-files "info.rkt"))
;;
;;; Packages
(use-package! racket-mode (use-package! racket-mode
:hook (racket-repl-mode . racket-unicode-input-method-enable) :hook (racket-repl-mode . racket-unicode-input-method-enable)
:config :config

View file

@ -1,5 +1,9 @@
;;; lang/ruby/config.el -*- lexical-binding: t; -*- ;;; lang/ruby/config.el -*- lexical-binding: t; -*-
(after! projectile
(add-to-list 'projectile-project-root-files "Gemfile"))
;; ;;
;;; Packages ;;; Packages

View file

@ -1,5 +1,12 @@
;;; lang/rust/config.el -*- lexical-binding: t; -*- ;;; lang/rust/config.el -*- lexical-binding: t; -*-
(after! projectile
(add-to-list 'projectile-project-root-files "Cargo.toml"))
;;
;;; Packages
(use-package! rust-mode (use-package! rust-mode
:defer t :defer t
:config :config

View file

@ -1,5 +1,12 @@
;;; lang/scala/config.el -*- lexical-binding: t; -*- ;;; lang/scala/config.el -*- lexical-binding: t; -*-
(after! projectile
(add-to-list 'projectile-project-root-files "build.sbt"))
;;
;;; Packages
(after! scala-mode (after! scala-mode
(setq scala-indent:align-parameters t (setq scala-indent:align-parameters t
;; indent block comments to first asterix, not second ;; indent block comments to first asterix, not second