dev: merge from master

This commit is contained in:
Matt Nish-Lapidus 2024-08-11 16:20:19 -04:00
commit 237251f442
19 changed files with 114 additions and 60 deletions

View file

@ -219,7 +219,7 @@ in."
file (/ size 1024 1024.0)) file (/ size 1024 1024.0))
(explain! "Consider deleting it from your system (manually)")))) (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")) (warn! "Couldn't find the `fd' binary; project file searches will be slightly slower"))
(require 'projectile) (require 'projectile)

View file

@ -12,19 +12,36 @@ Emacs.")
(defvar doom-projectile-cache-purge-non-projects nil (defvar doom-projectile-cache-purge-non-projects nil
"If non-nil, non-projects are purged from the cache on `kill-emacs-hook'.") "If non-nil, non-projects are purged from the cache on `kill-emacs-hook'.")
(defvar doom-projectile-fd-binary (define-obsolete-variable-alias 'doom-projectile-fd-binary 'doom-fd-executable "v3.0.0")
(cl-find-if #'executable-find (list "fdfind" "fd")) (defvar doom-fd-executable (cl-find-if #'executable-find (list "fdfind" "fd"))
"The filename of the `fd' executable. On some distros it's 'fdfind' (ubuntu, "The filename of the fd executable.
debian, and derivatives). On most it's 'fd'.")
(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.")
;; ;;
;;; Packages ;;; Packages
(after! project (use-package! project
(setq project-list-file (file-name-concat doom-data-dir "projects"))) :defer t
: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'.
)
;; DEPRECATED: Will be replaced with project.el ;; DEPRECATED: Will be replaced with project.el
(use-package! projectile (use-package! projectile
@ -44,7 +61,8 @@ debian, and derivatives). On most it's 'fd'.")
projectile-kill-buffers-filter 'kill-only-files projectile-kill-buffers-filter 'kill-only-files
projectile-known-projects-file (concat doom-cache-dir "projectile.projects") projectile-known-projects-file (concat doom-cache-dir "projectile.projects")
projectile-ignored-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 evil-jump-to-tag] #'projectile-find-tag)
(global-set-key [remap find-tag] #'projectile-find-tag) (global-set-key [remap find-tag] #'projectile-find-tag)
@ -81,20 +99,16 @@ debian, and derivatives). On most it's 'fd'.")
;; ;;
;; 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
@ -104,8 +118,9 @@ debian, and derivatives). On most it's 'fd'.")
;; 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.
@ -150,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."
@ -166,41 +182,59 @@ 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))))
;; `projectile-generic-command' doesn't typically support a function, but my ;; HACK: `projectile-generic-command' doesn't typically support a function,
;; `doom--only-use-generic-command-a' advice allows this. I do it this way so ;; but my `doom--only-use-generic-command-a' advice allows this. I do it
;; that projectile can adapt to remote systems (over TRAMP), rather then look ;; this way to make it easier for folks to undo the change (if not set to a
;; for fd/ripgrep on the remote system simply because it exists on the host. ;; function, projectile will revert to default behavior).
;; It's faster too.
(put 'projectile-git-submodule-command 'initial-value projectile-git-submodule-command) (put 'projectile-git-submodule-command 'initial-value projectile-git-submodule-command)
(setq projectile-git-submodule-command nil (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-indexing-method 'hybrid
projectile-generic-command projectile-generic-command
(lambda (_) (lambda (_)
;; If fd exists, use it for git and generic projects. fd is a rust ;; If fd or ripgrep exists, use it to produce file listings for
;; program that is significantly faster than git ls-files or find, and ;; projectile commands. fd is a rust program that is significantly
;; it respects .gitignore. This is recommended in the projectile docs. ;; faster than git ls-files, find, or the various VCS commands
;; projectile is configured to use. Plus, it respects .gitignore.
(cond (cond
((when-let* ((when-let*
((bin (if (ignore-errors (file-remote-p default-directory nil t)) ((doom-fd-executable)
(cl-find-if (doom-rpartial #'executable-find t) (projectile-git-use-fd)
(list "fdfind" "fd"))
doom-projectile-fd-binary))
;; REVIEW Temporary fix for #6618. Improve me later. ;; REVIEW Temporary fix for #6618. Improve me later.
(version (with-memoization doom-projects--fd-version (version (with-memoization (get 'doom-fd-executable 'version)
(cadr (split-string (cdr (doom-call-process bin "--version")) (cadr (split-string (cdr (doom-call-process doom-fd-executable "--version"))
" " t)))) " " t))))
((ignore-errors (version-to-list version)))) ((ignore-errors (version-to-list version))))
(concat (format "%s . -0 -H --color=never --type file --type symlink --follow --exclude .git %s" (string-join
bin (if (version< version "8.3.0") (delq
"" "--strip-cwd-prefix")) nil (list doom-fd-executable "."
(if doom--system-windows-p " --path-separator=/")))) (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 ;; Otherwise, resort to ripgrep, which is also faster than find
((executable-find "rg" t) (doom-ripgrep-executable
(concat "rg -0 --files --follow --color=never --hidden -g!.git" (string-join
(if doom--system-windows-p " --path-separator=/"))) (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'")
("find . -type f -print0")))) ("find . -type f -print0"))))
(defadvice! doom--projectile-default-generic-command-a (fn &rest args) (defadvice! doom--projectile-default-generic-command-a (fn &rest args)

View file

@ -286,7 +286,7 @@ workable results ripgrep produces, despite the error."
"Change `counsel-file-jump' to use fd or ripgrep, if they are available." "Change `counsel-file-jump' to use fd or ripgrep, if they are available."
:override #'counsel--find-return-list :override #'counsel--find-return-list
(cl-destructuring-bind (find-program . args) (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") (append (list fd "--hidden" "--type" "file" "--type" "symlink" "--follow" "--color=never")
(cl-loop for dir in projectile-globally-ignored-directories (cl-loop for dir in projectile-globally-ignored-directories
collect "--exclude" collect "--exclude"

View file

@ -211,15 +211,15 @@ targets."
;;;###autoload ;;;###autoload
(defun +vertico/consult-fd-or-find (&optional dir initial) (defun +vertico/consult-fd-or-find (&optional dir initial)
"Runs consult-fd if fd version > 8.6.0 exists, consult-find otherwise. "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") (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 ;; 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* (if (when-let*
((bin (if (ignore-errors (file-remote-p default-directory nil t)) ((bin (if (ignore-errors (file-remote-p default-directory nil t))
(cl-find-if (doom-rpartial #'executable-find t) (cl-find-if (doom-rpartial #'executable-find t)
(list "fdfind" "fd")) (list "fdfind" "fd"))
doom-projectile-fd-binary)) doom-fd-executable))
(version (with-memoization doom-projects--fd-version (version (with-memoization (get 'doom-fd-executable 'version)
(cadr (split-string (cdr (doom-call-process bin "--version")) (cadr (split-string (cdr (doom-call-process bin "--version"))
" " t)))) " " t))))
((ignore-errors (version-to-list version)))) ((ignore-errors (version-to-list version))))

View file

@ -210,7 +210,7 @@ orderless."
"C-x C-d" #'consult-dir "C-x C-d" #'consult-dir
"C-x C-j" #'consult-dir-jump-file)) "C-x C-j" #'consult-dir-jump-file))
:config :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) (setq consult-dir-project-list-function #'consult-dir-projectile-dirs)
(when (modulep! :tools docker) (when (modulep! :tools docker)

View file

@ -211,7 +211,7 @@ we have to clean it up ourselves."
(use-package! fd-dired (use-package! fd-dired
:when doom-projectile-fd-binary :when doom-fd-executable
:defer t :defer t
:init :init
(global-set-key [remap find-dired] #'fd-dired) (global-set-key [remap find-dired] #'fd-dired)

View file

@ -3,7 +3,7 @@
#+since: 21.12.0 #+since: 21.12.0
* Description * 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. ecosystems into (Doom) Emacs.
* Frequently asked questions * Frequently asked questions

View file

@ -75,8 +75,7 @@ recommended.
+ clangd (must be v9 or newer) :: clangd is included with =llvm= which should be + clangd (must be v9 or newer) :: clangd is included with =llvm= which should be
available through your OS' package manager. available through your OS' package manager.
- Linux: - Linux:
- Debian 11 & Ubuntu 20.10: ~$ apt-get install clangd-11~ - Debian & Ubuntu: ~$ apt-get install clangd~
- 20.04 LTS: [[https://pkgs.org/search/?q=clangd][clangd-10]]
- Fedora & CentOS/RHEL 8+: ~$ dnf install clang-tools-extra~ - Fedora & CentOS/RHEL 8+: ~$ dnf install clang-tools-extra~
- openSUSE: ~$ zypper install clang~ - openSUSE: ~$ zypper install clang~
- Arch: ~$ pacman -S clang~ - Arch: ~$ pacman -S clang~

View file

@ -303,6 +303,9 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e
:defer t :defer t
:init :init
(defvar ccls-sem-highlight-method 'font-lock) (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 (after! projectile
(add-to-list 'projectile-globally-ignored-directories "^.ccls-cache$") (add-to-list 'projectile-globally-ignored-directories "^.ccls-cache$")
(add-to-list 'projectile-project-root-files-bottom-up ".ccls-root") (add-to-list 'projectile-project-root-files-bottom-up ".ccls-root")

View file

@ -1,5 +1,6 @@
;;; lang/elixir/config.el -*- lexical-binding: t; -*- ;;; lang/elixir/config.el -*- lexical-binding: t; -*-
;; DEPRECATED: Remove when projectile is replaced with project.el
(after! projectile (after! projectile
(add-to-list 'projectile-project-root-files "mix.exs")) (add-to-list 'projectile-project-root-files "mix.exs"))

View file

@ -1,5 +1,9 @@
;;; lang/gdscript/config.el -*- lexical-binding: t; -*- ;;; 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 (after! projectile
(add-to-list 'projectile-project-root-files "project.godot")) (add-to-list 'projectile-project-root-files "project.godot"))

View file

@ -1,5 +1,6 @@
;;; lang/haskell/config.el -*- lexical-binding: t; -*- ;;; lang/haskell/config.el -*- lexical-binding: t; -*-
;; DEPRECATED: Remove when projectile is replaced with project.el
(after! projectile (after! projectile
(add-to-list 'projectile-project-root-files "stack.yaml")) (add-to-list 'projectile-project-root-files "stack.yaml"))

View file

@ -68,7 +68,9 @@ gfm-mode:
- ~$ pip install proselint~ - ~$ pip install proselint~
- Or through your OS package manager - Or through your OS package manager
- MacOS: ~$ brew install proselint~ - 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~) - [[https://github.com/textlint/textlint][textlint]] (~$ npm install textlint~)
** Markdown compiler ** Markdown compiler

View file

@ -187,7 +187,12 @@ brew install gnuplot
#+begin_src sh #+begin_src sh
pacman -S texlive-core texlive-bin texlive-science texlive-latexextra pacman -S texlive-core texlive-bin texlive-science texlive-latexextra
pacman -S gnuplot 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 #+end_src
** NixOS ** NixOS

View file

@ -12,6 +12,7 @@
(defvar +php-run-tests-in-docker nil (defvar +php-run-tests-in-docker nil
"Whether or not to run tests in a docker environment") "Whether or not to run tests in a docker environment")
;; DEPRECATED: Remove when projectile is replaced with project.el
(after! projectile (after! projectile
(add-to-list 'projectile-project-root-files "composer.json")) (add-to-list 'projectile-project-root-files "composer.json"))

View file

@ -1,5 +1,6 @@
;;; lang/racket/config.el -*- lexical-binding: t; -*- ;;; lang/racket/config.el -*- lexical-binding: t; -*-
;; DEPRECATED: Remove when projectile is replaced with project.el
(after! projectile (after! projectile
(add-to-list 'projectile-project-root-files "info.rkt")) (add-to-list 'projectile-project-root-files "info.rkt"))

View file

@ -1,5 +1,6 @@
;;; lang/ruby/config.el -*- lexical-binding: t; -*- ;;; lang/ruby/config.el -*- lexical-binding: t; -*-
;; DEPRECATED: Remove when projectile is replaced with project.el
(after! projectile (after! projectile
(add-to-list 'projectile-project-root-files "Gemfile")) (add-to-list 'projectile-project-root-files "Gemfile"))

View file

@ -1,5 +1,6 @@
;;; lang/rust/config.el -*- lexical-binding: t; -*- ;;; lang/rust/config.el -*- lexical-binding: t; -*-
;; DEPRECATED: Remove when projectile is replaced with project.el
(after! projectile (after! projectile
(add-to-list 'projectile-project-root-files "Cargo.toml")) (add-to-list 'projectile-project-root-files "Cargo.toml"))

View file

@ -1,5 +1,6 @@
;;; lang/zig/config.el -*- lexical-binding: t; -*- ;;; lang/zig/config.el -*- lexical-binding: t; -*-
;; DEPRECATED: Remove when projectile is replaced with project.el
(after! projectile (after! projectile
(add-to-list 'projectile-project-root-files "build.zig")) (add-to-list 'projectile-project-root-files "build.zig"))