From d3124c49718b3729c20b310870ae95e28db1b17b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 9 Aug 2024 20:42:33 -0400 Subject: [PATCH 1/9] nit: add deprecation comments for projectile config Ref: doomemacs/core#1 --- modules/completion/vertico/config.el | 2 +- modules/lang/cc/config.el | 1 + modules/lang/elixir/config.el | 1 + modules/lang/gdscript/config.el | 1 + modules/lang/haskell/config.el | 1 + modules/lang/php/config.el | 1 + modules/lang/racket/config.el | 1 + modules/lang/ruby/config.el | 1 + modules/lang/rust/config.el | 1 + modules/lang/zig/config.el | 1 + 10 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index a25826e53..19469b810 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -209,7 +209,7 @@ orderless." "C-x C-d" #'consult-dir "C-x C-j" #'consult-dir-jump-file)) :config - ;; DEPRECATED: Remove when Doom core replaces projectile with project.el + ;; DEPRECATED: Remove when projectile is replaced with project.el (setq consult-dir-project-list-function #'consult-dir-projectile-dirs) (when (modulep! :tools docker) diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index dbccd6d8a..3b15707d6 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -303,6 +303,7 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e :defer t :init (defvar ccls-sem-highlight-method 'font-lock) + ;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-globally-ignored-directories "^.ccls-cache$") (add-to-list 'projectile-project-root-files-bottom-up ".ccls-root") diff --git a/modules/lang/elixir/config.el b/modules/lang/elixir/config.el index 5a6771cd7..9c32685ea 100644 --- a/modules/lang/elixir/config.el +++ b/modules/lang/elixir/config.el @@ -1,5 +1,6 @@ ;;; lang/elixir/config.el -*- lexical-binding: t; -*- +;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "mix.exs")) diff --git a/modules/lang/gdscript/config.el b/modules/lang/gdscript/config.el index fde2b0050..076171ca6 100644 --- a/modules/lang/gdscript/config.el +++ b/modules/lang/gdscript/config.el @@ -1,5 +1,6 @@ ;;; lang/gdscript/config.el -*- lexical-binding: t; -*- +;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "project.godot")) diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index 03ec4d929..94d193116 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -1,5 +1,6 @@ ;;; lang/haskell/config.el -*- lexical-binding: t; -*- +;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "stack.yaml")) diff --git a/modules/lang/php/config.el b/modules/lang/php/config.el index 5f9d711f3..eb3a2512f 100644 --- a/modules/lang/php/config.el +++ b/modules/lang/php/config.el @@ -12,6 +12,7 @@ (defvar +php-run-tests-in-docker nil "Whether or not to run tests in a docker environment") +;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "composer.json")) diff --git a/modules/lang/racket/config.el b/modules/lang/racket/config.el index ab5f90489..46700f830 100644 --- a/modules/lang/racket/config.el +++ b/modules/lang/racket/config.el @@ -1,5 +1,6 @@ ;;; lang/racket/config.el -*- lexical-binding: t; -*- +;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "info.rkt")) diff --git a/modules/lang/ruby/config.el b/modules/lang/ruby/config.el index 31cc15c4b..68753bab5 100644 --- a/modules/lang/ruby/config.el +++ b/modules/lang/ruby/config.el @@ -1,5 +1,6 @@ ;;; lang/ruby/config.el -*- lexical-binding: t; -*- +;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "Gemfile")) diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index 1418ff530..e587ac2e6 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -1,5 +1,6 @@ ;;; lang/rust/config.el -*- lexical-binding: t; -*- +;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "Cargo.toml")) diff --git a/modules/lang/zig/config.el b/modules/lang/zig/config.el index ae69af00c..223d7aa5b 100644 --- a/modules/lang/zig/config.el +++ b/modules/lang/zig/config.el @@ -1,5 +1,6 @@ ;;; lang/zig/config.el -*- lexical-binding: t; -*- +;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "build.zig")) From 939fc0d3227706459e7ba74d53e2c0fd3d07ccba Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 9 Aug 2024 20:49:18 -0400 Subject: [PATCH 2/9] feat: add project-vc config I intend to keep `project-vc-extra-root-markers` much lighter than what `projectile-project-root-files` ended up being, so I won't be transferring all the root markers. Ref: doomemacs/core#1 --- lisp/doom-projects.el | 12 ++++++++++-- modules/lang/cc/config.el | 2 ++ modules/lang/gdscript/config.el | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index ad498b5da..25c1851ba 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -23,8 +23,16 @@ debian, and derivatives). On most it's 'fd'.") ;; ;;; Packages -(after! project - (setq project-list-file (file-name-concat doom-data-dir "projects"))) +(use-package! project + :defer t + :init + (setq project-list-file (file-name-concat doom-profile-state-dir "projects")) + :config + (add-to-list 'project-vc-extra-root-markers ".jj") + + ;; TODO: Advice or add command for project-wide `find-sibling-file'. + ) + ;; DEPRECATED: Will be replaced with project.el (use-package! projectile diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index 3b15707d6..e69e28ec2 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -303,6 +303,8 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e :defer t :init (defvar ccls-sem-highlight-method 'font-lock) + (after! project + (add-to-list 'project-vc-ignores "^\\.ccls-cache$")) ;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-globally-ignored-directories "^.ccls-cache$") diff --git a/modules/lang/gdscript/config.el b/modules/lang/gdscript/config.el index 076171ca6..f8ee13ec4 100644 --- a/modules/lang/gdscript/config.el +++ b/modules/lang/gdscript/config.el @@ -1,5 +1,8 @@ ;;; lang/gdscript/config.el -*- lexical-binding: t; -*- +(after! project + (add-to-list 'project-vc-extra-root-markers "project.godot")) + ;; DEPRECATED: Remove when projectile is replaced with project.el (after! projectile (add-to-list 'projectile-project-root-files "project.godot")) From 4fcf3327491551b022ac4ad94d342bc05f0fdd69 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 9 Aug 2024 20:54:23 -0400 Subject: [PATCH 3/9] refactor: generalize fd/ripgrep vars & options I intend to eventually replace projectile with project.el, so these doom-projectile-* variables need to be generalized, starting with the fd/ripgrep executable paths. ALong with that, this refactors Doom's projectile-generic-command to lean more on built-in fd support in projectile, where possible (fewer wheels reinvented). Ref: doomemacs/core#1 --- lisp/cli/doctor.el | 2 +- lisp/doom-projects.el | 69 +++++++++++-------- modules/completion/ivy/config.el | 2 +- .../completion/vertico/autoload/vertico.el | 6 +- modules/emacs/dired/config.el | 2 +- 5 files changed, 48 insertions(+), 33 deletions(-) diff --git a/lisp/cli/doctor.el b/lisp/cli/doctor.el index 5b4ecd5dc..62a3246e6 100644 --- a/lisp/cli/doctor.el +++ b/lisp/cli/doctor.el @@ -219,7 +219,7 @@ in." file (/ size 1024 1024.0)) (explain! "Consider deleting it from your system (manually)")))) - (unless (ignore-errors (executable-find doom-projectile-fd-binary)) + (unless (ignore-errors (executable-find doom-fd-executable)) (warn! "Couldn't find the `fd' binary; project file searches will be slightly slower")) (require 'projectile) diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index 25c1851ba..4b1e1aa2a 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -12,12 +12,17 @@ Emacs.") (defvar doom-projectile-cache-purge-non-projects nil "If non-nil, non-projects are purged from the cache on `kill-emacs-hook'.") -(defvar doom-projectile-fd-binary - (cl-find-if #'executable-find (list "fdfind" "fd")) - "The filename of the `fd' executable. On some distros it's 'fdfind' (ubuntu, -debian, and derivatives). On most it's 'fd'.") +(define-obsolete-variable-alias 'doom-projectile-fd-binary 'doom-fd-executable "v3.0.0") +(defvar doom-fd-executable (cl-find-if #'executable-find (list "fdfind" "fd")) + "The filename of the fd executable. -(defvar doom-projects--fd-version nil) +On some distros it's fdfind (ubuntu, debian, and derivatives). On most it's fd. +Is nil if no executable is found in your PATH during startup.") + +(defvar doom-ripgrep-executable (executable-find "rg") + "The filename of the Ripgrep executable. + +Is nil if no executable is found in your PATH during startup.") ;; @@ -52,7 +57,8 @@ debian, and derivatives). On most it's 'fd'.") projectile-kill-buffers-filter 'kill-only-files projectile-known-projects-file (concat doom-cache-dir "projectile.projects") projectile-ignored-projects '("~/") - projectile-ignored-project-function #'doom-project-ignored-p) + projectile-ignored-project-function #'doom-project-ignored-p + projectile-fd-executable doom-fd-executable) (global-set-key [remap evil-jump-to-tag] #'projectile-find-tag) (global-set-key [remap find-tag] #'projectile-find-tag) @@ -177,38 +183,47 @@ And if it's a function, evaluate it." (get 'projectile-git-submodule-command 'initial-value))) (funcall fn vcs)))) - ;; `projectile-generic-command' doesn't typically support a function, but my - ;; `doom--only-use-generic-command-a' advice allows this. I do it this way so - ;; that projectile can adapt to remote systems (over TRAMP), rather then look - ;; for fd/ripgrep on the remote system simply because it exists on the host. - ;; It's faster too. + ;; HACK: `projectile-generic-command' doesn't typically support a function, + ;; but my `doom--only-use-generic-command-a' advice allows this. I do it + ;; this way to make it easier for folks to undo the change (if not set to a + ;; function, projectile will revert to default behavior). (put 'projectile-git-submodule-command 'initial-value projectile-git-submodule-command) (setq projectile-git-submodule-command nil + ;; Include and follow symlinks in file listings. + projectile-git-fd-args (concat "-L -tl " projectile-git-fd-args " --ignore-file .project") projectile-indexing-method 'hybrid projectile-generic-command (lambda (_) - ;; If fd exists, use it for git and generic projects. fd is a rust - ;; program that is significantly faster than git ls-files or find, and - ;; it respects .gitignore. This is recommended in the projectile docs. + ;; If fd or ripgrep exists, use it to produce file listings for + ;; projectile commands. fd is a rust program that is significantly + ;; faster than git ls-files, find, or the various VCS commands + ;; projectile is configured to use. Plus, it respects .gitignore. (cond ((when-let* - ((bin (if (ignore-errors (file-remote-p default-directory nil t)) - (cl-find-if (doom-rpartial #'executable-find t) - (list "fdfind" "fd")) - doom-projectile-fd-binary)) + ((doom-fd-executable) + (projectile-git-use-fd) ;; REVIEW Temporary fix for #6618. Improve me later. - (version (with-memoization doom-projects--fd-version - (cadr (split-string (cdr (doom-call-process bin "--version")) + (version (with-memoization (get 'doom-fd-executable 'version) + (cadr (split-string (cdr (doom-call-process doom-fd-executable "--version")) " " t)))) ((ignore-errors (version-to-list version)))) - (concat (format "%s . -0 -H --color=never --type file --type symlink --follow --exclude .git %s" - bin (if (version< version "8.3.0") - "" "--strip-cwd-prefix")) - (if doom--system-windows-p " --path-separator=/")))) + (string-join + (delq + nil (list doom-fd-executable "." + (if (version< version "8.3.0") + (replace-regexp-in-string "--strip-cwd-prefix" "" projectile-git-fd-args t t) + projectile-git-fd-args) + (if doom--system-windows-p " --path-separator=/" ""))) + " "))) ;; Otherwise, resort to ripgrep, which is also faster than find - ((executable-find "rg" t) - (concat "rg -0 --files --follow --color=never --hidden -g!.git" - (if doom--system-windows-p " --path-separator=/"))) + (doom-ripgrep-executable + (string-join + (delq + nil (list doom-ripgrep-executable + "-0 --files --follow --color=never --hidden" + (if doom--system-windows-p " --path-separator=/"))) + " ")) + ((not doom--system-windows-p) "find . -type f | cut -c3- | tr '\\n' '\\0'") ("find . -type f -print0")))) (defadvice! doom--projectile-default-generic-command-a (fn &rest args) diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index 308e29708..6a013e65c 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -286,7 +286,7 @@ workable results ripgrep produces, despite the error." "Change `counsel-file-jump' to use fd or ripgrep, if they are available." :override #'counsel--find-return-list (cl-destructuring-bind (find-program . args) - (cond ((when-let (fd (executable-find (or doom-projectile-fd-binary "fd") t)) + (cond ((when-let (fd (executable-find (or doom-fd-executable "fd") t)) (append (list fd "--hidden" "--type" "file" "--type" "symlink" "--follow" "--color=never") (cl-loop for dir in projectile-globally-ignored-directories collect "--exclude" diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index 50059b68b..7689a18bb 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -211,15 +211,15 @@ targets." ;;;###autoload (defun +vertico/consult-fd-or-find (&optional dir initial) "Runs consult-fd if fd version > 8.6.0 exists, consult-find otherwise. -See URL `https://github.com/minad/consult/issues/770'." +See minad/consult#770." (interactive "P") ;; TODO this condition was adapted from a similar one in lisp/doom-projects.el, to be replaced with a more robust check post v3 (if (when-let* ((bin (if (ignore-errors (file-remote-p default-directory nil t)) (cl-find-if (doom-rpartial #'executable-find t) (list "fdfind" "fd")) - doom-projectile-fd-binary)) - (version (with-memoization doom-projects--fd-version + doom-fd-executable)) + (version (with-memoization (get 'doom-fd-executable 'version) (cadr (split-string (cdr (doom-call-process bin "--version")) " " t)))) ((ignore-errors (version-to-list version)))) diff --git a/modules/emacs/dired/config.el b/modules/emacs/dired/config.el index 3000fd2df..6e670476b 100644 --- a/modules/emacs/dired/config.el +++ b/modules/emacs/dired/config.el @@ -211,7 +211,7 @@ we have to clean it up ourselves." (use-package! fd-dired - :when doom-projectile-fd-binary + :when doom-fd-executable :defer t :init (global-set-key [remap find-dired] #'fd-dired) From d04e1404c285275239295cf8b6793a722ab36b64 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 9 Aug 2024 20:56:52 -0400 Subject: [PATCH 4/9] fix: projectile: ignore more vc directories in file listings --- lisp/doom-projects.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index 4b1e1aa2a..8b0e56f6d 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -33,6 +33,10 @@ Is nil if no executable is found in your PATH during startup.") :init (setq project-list-file (file-name-concat doom-profile-state-dir "projects")) :config + ;; Not valid vc backends, but I use it to inform (global) file index + ;; exclusions below and elsewhere. + (add-to-list 'project-vc-backend-markers-alist '(Jujutsu . ".jj")) + (add-to-list 'project-vc-backend-markers-alist '(Sapling . ".sl")) (add-to-list 'project-vc-extra-root-markers ".jj") ;; TODO: Advice or add command for project-wide `find-sibling-file'. @@ -213,6 +217,10 @@ And if it's a function, evaluate it." (if (version< version "8.3.0") (replace-regexp-in-string "--strip-cwd-prefix" "" projectile-git-fd-args t t) projectile-git-fd-args) + (when project-vc-backend-markers-alist + (mapconcat (fn! (format "-E %s" (shell-quote-argument (cdr %)))) + project-vc-backend-markers-alist + " ")) (if doom--system-windows-p " --path-separator=/" ""))) " "))) ;; Otherwise, resort to ripgrep, which is also faster than find @@ -221,6 +229,10 @@ And if it's a function, evaluate it." (delq nil (list doom-ripgrep-executable "-0 --files --follow --color=never --hidden" + (when project-vc-backend-markers-alist + (mapconcat (fn! (format "-g!%s" (shell-quote-argument (cdr %)))) + project-vc-backend-markers-alist + " ")) (if doom--system-windows-p " --path-separator=/"))) " ")) ((not doom--system-windows-p) "find . -type f | cut -c3- | tr '\\n' '\\0'") From d9d1737deb1106c75f33dd14088e37f4ff9bf1fe Mon Sep 17 00:00:00 2001 From: Skylar LK <147355821+SkylarLK@users.noreply.github.com> Date: Thu, 12 Oct 2023 21:33:57 -0400 Subject: [PATCH 5/9] docs(cc): future-proof Debian/Ubuntu install instructions The "clangd" package links to the version of clangd associated with that version of the distribution. In Debian 11 it's clangd-11, in 12 it's clangd-14, Ubuntu 22.04 LTS also has clangd-14, and 23.10 seems to have clangd-16. No need to specify the clangd package name for each release. Ref: #7502 --- modules/lang/cc/README.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/lang/cc/README.org b/modules/lang/cc/README.org index 158b3fef8..390620545 100644 --- a/modules/lang/cc/README.org +++ b/modules/lang/cc/README.org @@ -75,8 +75,7 @@ recommended. + clangd (must be v9 or newer) :: clangd is included with =llvm= which should be available through your OS' package manager. - Linux: - - Debian 11 & Ubuntu 20.10: ~$ apt-get install clangd-11~ - - 20.04 LTS: [[https://pkgs.org/search/?q=clangd][clangd-10]] + - Debian & Ubuntu: ~$ apt-get install clangd~ - Fedora & CentOS/RHEL 8+: ~$ dnf install clang-tools-extra~ - openSUSE: ~$ zypper install clang~ - Arch: ~$ pacman -S clang~ From ab1d396c2dd319ef84a4064aeb83cec942d32803 Mon Sep 17 00:00:00 2001 From: Skylar LK <147355821+SkylarLK@users.noreply.github.com> Date: Fri, 13 Oct 2023 01:25:05 -0400 Subject: [PATCH 6/9] docs(org): update install docs for Ubuntu/Debian & Arch - Added Debian & Ubuntu section. - Arch Linux no longer has a package called "jupyter". Ref: #7502 --- modules/lang/org/README.org | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/lang/org/README.org b/modules/lang/org/README.org index 08fcc2cb1..beb9f86e0 100644 --- a/modules/lang/org/README.org +++ b/modules/lang/org/README.org @@ -187,7 +187,12 @@ brew install gnuplot #+begin_src sh pacman -S texlive-core texlive-bin texlive-science texlive-latexextra pacman -S gnuplot -pacman -S jupyter # required by +jupyter +#+end_src + +** Debian & Ubuntu +#+begin_src sh +apt-get install texlive dvipng +apt-get install gnuplot #+end_src ** NixOS From 52aadcd01fec8040338900d020fadf063501fe2c Mon Sep 17 00:00:00 2001 From: Skylar LK <147355821+SkylarLK@users.noreply.github.com> Date: Fri, 13 Oct 2023 01:32:04 -0400 Subject: [PATCH 7/9] docs(:lang): correct grammar Ref: #7502 --- modules/lang/README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/README.org b/modules/lang/README.org index 4a81da472..15afda74d 100644 --- a/modules/lang/README.org +++ b/modules/lang/README.org @@ -3,7 +3,7 @@ #+since: 21.12.0 * Description -These modules specialize in integration particular languages and their +These modules specialize in the integration of particular languages and their ecosystems into (Doom) Emacs. * Frequently asked questions From 6e1bfe97c04e58a4573b8ff1e945d2b6bd5bae19 Mon Sep 17 00:00:00 2001 From: Skylar LK <147355821+SkylarLK@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:41:56 -0400 Subject: [PATCH 8/9] docs(markdown): expand proselint install docs For some reason, the proselint package is not in the official Arch repositories (at least not anymore), but is in the AUR. Ref: #7502 --- modules/lang/markdown/README.org | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/lang/markdown/README.org b/modules/lang/markdown/README.org index 686df4a04..72ea069d0 100644 --- a/modules/lang/markdown/README.org +++ b/modules/lang/markdown/README.org @@ -68,7 +68,9 @@ gfm-mode: - ~$ pip install proselint~ - Or through your OS package manager - MacOS: ~$ brew install proselint~ - - Arch Linux: ~$ pacman -S proselint~ + - Arch Linux: [[https://aur.archlinux.org/packages/proselint][proselint in AUR]] + - Debian & Ubuntu: ~$ apt-get install python3-proselint~ + - Fedora: ~$ dnf install proselint~ - [[https://github.com/textlint/textlint][textlint]] (~$ npm install textlint~) ** Markdown compiler From f5020a4f7f228a84a51039a57fbf67107a0f2d74 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 9 Aug 2024 21:19:30 -0400 Subject: [PATCH 9/9] 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. --- lisp/doom-projects.el | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index 8b0e56f6d..b59c40903 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -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 ;; files/directories projectile searches for when resolving the project root. - (setq projectile-project-root-files-bottom-up - (append '(".projectile" ; projectile's root marker - ".project" ; doom project marker - ".git") ; Git VCS root dir - (when (executable-find "hg") - '(".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 '() + ;; + ;; These 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. + (setq projectile-project-root-files '() 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) ;; 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 (defadvice! doom--projectile-dirconfig-file-a () :override #'projectile-dirconfig-file - (cond ((file-exists-p! (or ".projectile" ".project") (projectile-project-root))) - ((expand-file-name ".project" (projectile-project-root))))) + (let ((proot (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 ;; better alternative for. @@ -168,14 +165,15 @@ c) are not valid projectile projects." and do (remhash proot projectile-project-type-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 (setenv "MSYS_NO_PATHCONV" "1") ; Fix path in Git Bash (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 - ;; 7 commands to maintain, versus the more generic, reliable and - ;; performant `fd' or `ripgrep'. + ;; HACK: Don't rely on VCS-specific commands to generate our file lists. + ;; That's 7 commands to maintain, versus the more generic, reliable, and + ;; performant `fd' or `ripgrep'. (defadvice! doom--only-use-generic-command-a (fn vcs) "Only use `projectile-generic-command' for indexing project files. 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))) (funcall projectile-generic-command vcs) (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)))) ;; HACK: `projectile-generic-command' doesn't typically support a function,