diff --git a/lisp/cli/env.el b/lisp/cli/env.el index 808878985..6d06f9136 100644 --- a/lisp/cli/env.el +++ b/lisp/cli/env.el @@ -21,7 +21,7 @@ "^HOME$" "^\\(OLD\\)?PWD$" "^SHLVL$" "^PS1$" "^R?PROMPT$" "^TERM\\(CAP\\)?$" "^USER$" "^GIT_CONFIG" "^INSIDE_EMACS$" ;; X server, Wayland, or services' env that shouldn't be persisted - "^DISPLAY$" "^WAYLAND_DISPLAY" "^DBUS_SESSION_BUS_ADDRESS$" "^XAUTHORITY$" + "^\\(WAYLAND_\\)?DISPLAY$" "^DBUS_SESSION_BUS_ADDRESS$" "^XAUTHORITY$" ;; Windows+WSL envvars that shouldn't be persisted "^WSL_INTEROP$" ;; XDG variables that are best not persisted. diff --git a/lisp/cli/packages.el b/lisp/cli/packages.el index 09f72dc32..c1a515fbe 100644 --- a/lisp/cli/packages.el +++ b/lisp/cli/packages.el @@ -704,6 +704,31 @@ original state.") ;; noninteractive sessions. (advice-add #'straight-vc-git--popup-raw :override #'straight--popup-raw) +;; HACK: `native-comp' only respects `native-comp-jit-compilation-deny-list' +;; when native-compiling packages in interactive sessions. It ignores the +;; variable when, say, straight is building packages. This advice forces it to +;; obey it, even when used by straight (but only in the CLI). +(defadvice! doom-cli--native--compile-async-skip-p (fn files &optional recursively load selector) + :around #'native-compile-async + (let (file-list) + (dolist (file-or-dir (ensure-list files)) + (cond ((file-directory-p file-or-dir) + (dolist (file (if recursively + (directory-files-recursively + file-or-dir comp-valid-source-re) + (directory-files file-or-dir + t comp-valid-source-re))) + (push file file-list))) + ((file-exists-p file-or-dir) + (push file-or-dir file-list)) + ((signal 'native-compiler-error + (list "Not a file nor directory" file-or-dir))))) + (funcall fn (seq-remove (lambda (file) + (seq-some (lambda (re) (string-match-p re file)) + native-comp-deferred-compilation-deny-list)) + file-list) + recursively load selector))) + ;; HACK Replace GUI popup prompts (which hang indefinitely in tty Emacs) with ;; simple prompts. (defadvice! doom-cli--straight-fallback-to-y-or-n-prompt-a (fn &optional prompt noprompt?) diff --git a/lisp/doom-packages.el b/lisp/doom-packages.el index 5a6cb7e4e..22f73aef6 100644 --- a/lisp/doom-packages.el +++ b/lisp/doom-packages.el @@ -140,7 +140,8 @@ uses a straight or package.el command directly).") (after! comp ;; HACK Disable native-compilation for some troublesome packages (mapc (doom-partial #'add-to-list 'native-comp-deferred-compilation-deny-list) - (list "/emacs-jupyter.*\\.el\\'" + (list "/seq-tests\\.el\\'" + "/emacs-jupyter.*\\.el\\'" "/evil-collection-vterm\\.el\\'" "/vterm\\.el\\'" "/with-editor\\.el\\'")))) diff --git a/modules/config/default/+emacs-bindings.el b/modules/config/default/+emacs-bindings.el index d076cff2e..b40c0d3e0 100644 --- a/modules/config/default/+emacs-bindings.el +++ b/modules/config/default/+emacs-bindings.el @@ -170,9 +170,10 @@ :desc "Toggle last org-clock" "c" #'+org/toggle-last-clock :desc "Cancel current org-clock" "C" #'org-clock-cancel - :desc "Open deft" "d" #'deft + (:when (modulep! :ui deft) + :desc "Open deft" "d" #'deft) (:when (modulep! :lang org +noter) - :desc "Org noter" "e" #'org-noter) + :desc "Org noter" "e" #'org-noter) :desc "Find file in notes" "f" #'+default/find-in-notes :desc "Browse notes" "F" #'+default/browse-notes diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 445ce4b8a..722ff88a6 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -609,9 +609,10 @@ :desc "Toggle last org-clock" "c" #'+org/toggle-last-clock :desc "Cancel current org-clock" "C" #'org-clock-cancel - :desc "Open deft" "d" #'deft + (:when (modulep! :ui deft) + :desc "Open deft" "d" #'deft) (:when (modulep! :lang org +noter) - :desc "Org noter" "e" #'org-noter) + :desc "Org noter" "e" #'org-noter) :desc "Find file in notes" "f" #'+default/find-in-notes :desc "Browse notes" "F" #'+default/browse-notes diff --git a/modules/editor/format/autoload/format.el b/modules/editor/format/autoload/format.el index fe78af107..aeed07770 100644 --- a/modules/editor/format/autoload/format.el +++ b/modules/editor/format/autoload/format.el @@ -8,6 +8,9 @@ ;;;###autoload (autoload 'apheleia--get-formatters "apheleia-formatters") +;;;###autoload +(defvar +format--region-p nil) + ;;;###autoload (defun +format-region (start end &optional callback) "Format from START to END with `apheleia'." @@ -41,22 +44,21 @@ (when (> indent 0) (indent-rigidly (point-min) (point-max) (- indent))) ;; - (apheleia-format-buffer - command - (lambda () - (with-current-buffer formatted-buffer - (when (> indent 0) - ;; restore indentation without affecting new indentation - (indent-rigidly (point-min) (point-max) - (max 0 (- indent (+format--current-indentation))))) - (set-buffer-modified-p nil)) - (with-current-buffer cur-buffer - (delete-region start end) - (goto-char start) - (save-excursion - (insert-buffer-substring-no-properties formatted-buffer) - (when callback (funcall callback))) - (kill-buffer formatted-buffer))))) + (let ((+format--region-p (cons start end))) + (apheleia-format-buffer + command + (lambda () + (with-current-buffer formatted-buffer + (when (> indent 0) + ;; restore indentation without affecting new indentation + (indent-rigidly (point-min) (point-max) + (max 0 (- indent (+format--current-indentation))))) + (set-buffer-modified-p nil)) + (with-current-buffer cur-buffer + (with-silent-modifications + (replace-region-contents start end (lambda () formatted-buffer) 5)) + (when callback (funcall callback)) + (kill-buffer formatted-buffer)))))) (when (doom-region-active-p) (setq deactivate-mark t))))) diff --git a/modules/editor/format/autoload/lsp.el b/modules/editor/format/autoload/lsp.el index ac8daeb76..c9cc5540c 100644 --- a/modules/editor/format/autoload/lsp.el +++ b/modules/editor/format/autoload/lsp.el @@ -46,40 +46,38 @@ mode unconditionally, call `+format-with-lsp-mode' instead." (cl-defun +format-lsp-buffer (&rest plist &key buffer callback &allow-other-keys) "Format the current buffer with any available lsp-mode or eglot formatter." (if-let* ((fn (with-current-buffer buffer (+format--lsp-fn))) - ((apply fn plist))) + ((apply fn (car +format--region-p) (cdr +format--region-p) + plist))) (funcall callback) (funcall callback "LSP server doesn't support formatting"))) -(cl-defun +format--with-lsp-mode (&key buffer scratch &allow-other-keys) - "Format the current buffer with any available lsp-mode formatter." +(cl-defun +format--with-lsp-mode (beg end &key buffer &allow-other-keys) + "Format the current buffer or region with any available lsp-mode formatter. + +Won't forward the buffer to chained formatters if successful." (with-current-buffer buffer (let ((edits - (cond - ((lsp-feature? "textDocument/formatting") - (lsp-request "textDocument/formatting" - (lsp--make-document-formatting-params))) - ((lsp-feature? "textDocument/rangeFormatting") - (lsp-request "textDocument/rangeFormatting" - (lsp--make-document-range-formatting-params - (point-min) (point-max)))) - (:err)))) - (unless (eq edits :err) - (unless (seq-empty-p edits) - (with-current-buffer scratch - (lsp--apply-text-edits edits 'format))) - t)))) - -(cl-defun +format--with-eglot (&key buffer scratch &allow-other-keys) - "Format the current buffer with any available eglot formatter." - (with-current-buffer scratch - (when (setq-local - eglot--cached-server - (with-current-buffer buffer - (when (or (eglot-server-capable :documentFormattingProvider) - (eglot-server-capable :documentRangeFormattingProvider)) - (eglot-current-server)))) - (let ((buffer-file-name (buffer-file-name buffer))) - (eglot-format-buffer)) + (cond ((and (null beg) (lsp-feature? "textDocument/formatting")) + (lsp-request "textDocument/formatting" + (lsp--make-document-formatting-params))) + ((lsp-feature? "textDocument/rangeFormatting") + (lsp-request "textDocument/rangeFormatting" + (lsp--make-document-range-formatting-params + (or beg (point-min)) (or end (point-max))))) + ;; try next chained formatter(s) + ((cl-return (ignore (funcall callback))))))) + (unless (seq-empty-p edits) + (lsp--apply-text-edits edits 'format)) t))) +(cl-defun +format--with-eglot (beg end &key buffer callback &allow-other-keys) + "Format the current buffer or region with any available eglot formatter. + +Won't forward the buffer to chained formatters if successful." + (with-current-buffer buffer + (or (with-demoted-errors "%s" + (always (eglot-format beg end))) + ;; try next chained formatter(s) + (ignore (funcall callback))))) + ;;; lsp.el ends here diff --git a/modules/editor/format/config.el b/modules/editor/format/config.el index 3b011cbee..4ea019010 100644 --- a/modules/editor/format/config.el +++ b/modules/editor/format/config.el @@ -4,6 +4,7 @@ '(sql-mode ; sqlformat is currently broken tex-mode ; latexindent is broken latex-mode + LaTeX-mode org-msg-edit-mode) ; doesn't need a formatter "A list of major modes in which to not reformat the buffer upon saving. diff --git a/modules/emacs/dired/config.el b/modules/emacs/dired/config.el index c303ec911..27ec10311 100644 --- a/modules/emacs/dired/config.el +++ b/modules/emacs/dired/config.el @@ -105,27 +105,29 @@ Fixes #3939: unsortable dired entries on Windows." (setq dirvish-subtree-always-show-state t) (appendq! dirvish-attributes '(nerd-icons subtree-state))) - ;; HACK: Makes `dirvish-hide-details' accept a list of symbols to instruct - ;; Dirvish in what contexts `dirvish-hide-details' should be enabled. The - ;; accepted values are: + ;; HACK: Makes `dirvish-hide-details' and `dirvish-hide-cursor' accept a list + ;; of symbols to instruct Dirvish in what contexts they should be enabled. + ;; The accepted values are: ;; - `dired': when opening a directory directly or w/o Dirvish's full UI. ;; - `dirvish': when opening full-frame Dirvish. ;; - `dirvish-side': when opening Dirvish in the sidebar. - ;; REVIEW: Upstream this behavior later. (Maybe with similar treatment for - ;; `dirvish-hide-cursor'?) - (setq dirvish-hide-details '(dirvish dirvish-side)) + ;; REVIEW: Upstream this behavior later. + (setq dirvish-hide-details '(dirvish dirvish-side) + dirvish-hide-cursor '(dirvish dirvish-side)) (defadvice! +dired--hide-details-maybe-a (fn &rest args) :around #'dirvish-init-dired-buffer - (let ((dirvish-hide-details - (if (listp dirvish-hide-details) - (cond ((if dirvish--this (memq 'side (dv-type dirvish--this))) - (memq 'dirvish-side dirvish-hide-details)) - ((or (null dirvish--this) - (null (car (dv-layout dirvish--this)))) - (memq 'dired dirvish-hide-details)) - ((memq 'dirvish dirvish-hide-details))) - dirvish-hide-details))) - (apply fn args))) + (letf! (defun enabled? (val) + (if (listp val) + (cond ((if dirvish--this (memq 'side (dv-type dirvish--this))) + (memq 'dirvish-side val)) + ((or (null dirvish--this) + (null (car (dv-layout dirvish--this)))) + (memq 'dired val)) + ((memq 'dirvish val))) + val)) + (let ((dirvish-hide-details (enabled? dirvish-hide-details))) + (setq-local dirvish-hide-cursor (and (enabled? dirvish-hide-cursor) t)) + (apply fn args)))) (when (modulep! :ui tabs) (after! centaur-tabs @@ -143,6 +145,11 @@ Fixes #3939: unsortable dired entries on Windows." :n "F" #'dirvish-layout-toggle :n "z" #'dirvish-history-jump :n "gh" #'dirvish-subtree-up + :n "gl" #'dirvish-subtree-toggle + :n "h" #'dired-up-directory + :n "l" #'dired-find-file + :gm [left] #'dired-up-directory + :gm [right] #'dired-find-file :m "[h" #'dirvish-history-go-backward :m "]h" #'dirvish-history-go-forward :m "[e" #'dirvish-emerge-next-group diff --git a/modules/lang/dart/config.el b/modules/lang/dart/config.el index b60e8d330..19f8c9f63 100644 --- a/modules/lang/dart/config.el +++ b/modules/lang/dart/config.el @@ -37,7 +37,10 @@ "f" #'flutter-run "q" #'flutter-quit "r" #'flutter-hot-reload - "R" #'flutter-hot-restart))) + "R" #'flutter-hot-restart)) + :config + (set-popup-rule! (concat "^" (regexp-quote flutter-buffer-name)) + :ttl 0 :quit t)) (use-package! lsp-dart diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 4a7b532f8..8627d2e01 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -234,6 +234,7 @@ See `+emacs-lisp-non-package-mode' for details.") :around #'elisp-demos--symbols :around #'elisp-demos--syntax-highlight (let ((org-inhibit-startup t) + (doom-inhibit-local-var-hooks t) enable-dir-local-variables org-mode-hook) (apply fn args)))) diff --git a/modules/lang/go/README.org b/modules/lang/go/README.org index 761ab8c9b..ae968d6da 100644 --- a/modules/lang/go/README.org +++ b/modules/lang/go/README.org @@ -13,7 +13,6 @@ This module adds [[https://golang.org][Go]] support, with optional (but recommen - REPL (~gore~) - Syntax-checking (~flycheck~) - Auto-formatting on save (~gofmt~) (requires [[doom-module::editor format +onsave]]) -- Code navigation & refactoring (~go-guru~) - [[../../editor/file-templates/templates/go-mode][File templates]] - [[https://github.com/hlissner/doom-snippets/tree/master/go-mode][Snippets]] - Generate testing code (~go-gen-test~) @@ -36,7 +35,6 @@ This module adds [[https://golang.org][Go]] support, with optional (but recommen - [[doom-package:flycheck-golangci-lint]] if [[doom-module::checkers syntax]] - [[doom-package:go-eldoc]] - [[doom-package:go-gen-test]] -- [[doom-package:go-guru]] - [[doom-package:go-mode]] - [[doom-package:gorepl-mode]] - [[doom-package:go-tag]] @@ -64,7 +62,6 @@ below. - ~godoc~ (for documentation lookup) - ~gorename~ (for extra refactoring commands) - ~gore~ (for the REPL) -- ~guru~ (for code navigation & refactoring commands) - ~goimports~ (/optional/: for auto-formatting code on save & fixing imports) - ~gotests~ (for generate test code) - ~gomodifytags~ (for manipulating tags) @@ -77,7 +74,6 @@ go install github.com/stamblerre/gocode@latest go install golang.org/x/tools/cmd/godoc@latest go install golang.org/x/tools/cmd/goimports@latest go install golang.org/x/tools/cmd/gorename@latest -go install golang.org/x/tools/cmd/guru@latest go install github.com/cweill/gotests/gotests@latest go install github.com/fatih/gomodifytags@latest #+end_src @@ -102,16 +98,6 @@ go install github.com/fatih/gomodifytags@latest | [[kbd:][ b b]] | run ~$ go build~ | | [[kbd:][ b r]] | run ~$ go run .~ | | [[kbd:][ h .]] | lookup symbol at point in godoc | -| [[kbd:][ h d]] | describe symbol at point | -| [[kbd:][ h v]] | list free variables | -| [[kbd:][ h i]] | list implements relations for package types | -| [[kbd:][ h p]] | list peers for channel | -| [[kbd:][ h P]] | "what does this point to" | -| [[kbd:][ h r]] | list references to object | -| [[kbd:][ h e]] | which errors | -| [[kbd:][ h w]] | what query | -| [[kbd:][ h c]] | show callers of function at point | -| [[kbd:][ h C]] | show callees of function at point | | [[kbd:][ t t]] | rerun last test | | [[kbd:][ t a]] | run all tests in project | | [[kbd:][ t f]] | run all tests in current file | diff --git a/modules/lang/go/config.el b/modules/lang/go/config.el index 6fc8c7bbe..861fdafd5 100644 --- a/modules/lang/go/config.el +++ b/modules/lang/go/config.el @@ -7,8 +7,6 @@ (set-docsets! 'go-mode "Go") (set-repl-handler! 'go-mode #'gorepl-run) (set-lookup-handlers! 'go-mode - :definition #'go-guru-definition - :references #'go-guru-referrers :documentation #'godoc-at-point) (if (modulep! +lsp) @@ -25,20 +23,9 @@ "e" #'+go/play-buffer-or-region "i" #'go-goto-imports ; Go to imports (:prefix ("h" . "help") - "." #'godoc-at-point ; Lookup in godoc - "d" #'go-guru-describe ; Describe this - "v" #'go-guru-freevars ; List free variables - "i" #'go-guru-implements ; Implements relations for package types - "p" #'go-guru-peers ; List peers for channel - "P" #'go-guru-pointsto ; What does this point to - "r" #'go-guru-referrers ; List references to object - "e" #'go-guru-whicherrs ; Which errors - "w" #'go-guru-what ; What query - "c" #'go-guru-callers ; Show callers of this function - "C" #'go-guru-callees) ; Show callees of this function + "." #'godoc-at-point) ; Lookup in godoc (:prefix ("ri" . "imports") - "a" #'go-import-add - "r" #'go-remove-unused-imports) + "a" #'go-import-add) (:prefix ("b" . "build") :desc "go run ." "r" (cmd! (compile "go run .")) :desc "go build" "b" (cmd! (compile "go build")) diff --git a/modules/lang/go/doctor.el b/modules/lang/go/doctor.el index 5ce6b331e..6bc97f69c 100644 --- a/modules/lang/go/doctor.el +++ b/modules/lang/go/doctor.el @@ -9,9 +9,6 @@ (modulep! :tools tree-sitter)) "This module requires (:tools tree-sitter)") -(unless (executable-find "guru") - (warn! "Couldn't find guru. Refactoring commands (go-guru-*) won't work")) - (unless (executable-find "gore") (warn! "Couldn't find gore. REPL will not work")) diff --git a/modules/lang/go/packages.el b/modules/lang/go/packages.el index 5cbc47159..0bf25637c 100644 --- a/modules/lang/go/packages.el +++ b/modules/lang/go/packages.el @@ -2,7 +2,6 @@ ;;; lang/go/packages.el (package! go-eldoc :pin "cbbd2ea1e94a36004432a9ac61414cb5a95a39bd") -(package! go-guru :pin "636d36e37a0d2b6adb2e12d802ff4794ccbba336") (package! go-mode :pin "636d36e37a0d2b6adb2e12d802ff4794ccbba336") (package! gorepl-mode :pin "6a73bf352e8d893f89cad36c958c4db2b5e35e07") (package! go-tag :pin "33f2059551d5298ca228d90f525b99d1a8d70364") diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index 65a07f42c..fdcfc5e15 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -100,7 +100,8 @@ If no viewer is found, `latex-preview-pane-mode' is used.") ;; Hook LSP, if enabled. (when (modulep! +lsp) (add-hook! '(tex-mode-local-vars-hook - latex-mode-local-vars-hook) + latex-mode-local-vars-hook + LaTeX-mode-local-vars-hook) :append #'lsp!)) ;; Define a function to compile the project. (defun +latex/compile () diff --git a/modules/lang/org/README.org b/modules/lang/org/README.org index beb9f86e0..9087c4ed4 100644 --- a/modules/lang/org/README.org +++ b/modules/lang/org/README.org @@ -189,6 +189,8 @@ pacman -S texlive-core texlive-bin texlive-science texlive-latexextra pacman -S gnuplot #+end_src +For [[doom-module:+jupyter]], install =jupyterlab= or =jupyter-notebook= ([[https://wiki.archlinux.org/title/Jupyter][source]]). + ** Debian & Ubuntu #+begin_src sh apt-get install texlive dvipng diff --git a/modules/lang/org/packages.el b/modules/lang/org/packages.el index 5fc023410..8cb561e8e 100644 --- a/modules/lang/org/packages.el +++ b/modules/lang/org/packages.el @@ -116,9 +116,6 @@ (package! ob-async :pin "9aac486073f5c356ada20e716571be33a350a982") (when (modulep! :lang clojure) (package! ob-clojure-literate - :recipe (:type git - :host nil - :repo "https://repo.or.cz/ob-clojure-literate.el.git") :pin "18c3ea15b872a43e67c899a9914182c35b00b7ee")) (when (modulep! :lang crystal) (package! ob-crystal :pin "d84c1adee4b269cdba06a97caedb8071561a09af")) diff --git a/modules/lang/php/README.org b/modules/lang/php/README.org index d2ea8b398..321ce8177 100644 --- a/modules/lang/php/README.org +++ b/modules/lang/php/README.org @@ -12,6 +12,7 @@ This module adds support for PHP 5.3+ (including PHP8) to Doom Emacs. - Code refactoring commands (~php-refactor-mode~) - Unit-test commands (~phpunit~) - Support for ~laravel~ and ~composer~ projects (with project-specific snippets) +- LSP support (via the [[doom-module:+lsp]] flag) - [[../../editor/file-templates/templates/php-mode][File templates]] - [[https://github.com/hlissner/doom-snippets/tree/master/php-mode][Snippets]] @@ -31,8 +32,8 @@ This module adds support for PHP 5.3+ (including PHP8) to Doom Emacs. - +hack :: Add support for the [[https://hacklang.org/][Hack dialect of PHP]] by Facebook. - +lsp :: - Enable LSP support for ~php-mode~. Requires [[doom-module::tools lsp]] and a langserver - (supports [[https://phpactor.readthedocs.io/en/develop/usage/standalone.html][phpactor]] and intelephense). + Enable LSP support for ~php-mode~. Requires [[doom-module::tools lsp]] and a + langserver (supports [[https://emacs-lsp.github.io/lsp-mode/page/lsp-phpactor/][phpactor]], [[https://emacs-lsp.github.io/lsp-mode/page/lsp-intelephense/][intelephense]], [[https://emacs-lsp.github.io/lsp-mode/page/lsp-serenata/][serenata]], [[https://emacs-lsp.github.io/lsp-mode/page/lsp-php/][php-language-server]]). - +tree-sitter :: Leverages tree-sitter for better syntax highlighting and structural text editing. Requires [[doom-module::tools tree-sitter]]. @@ -45,9 +46,6 @@ This module adds support for PHP 5.3+ (including PHP8) to Doom Emacs. - [[doom-package:php-mode]] - [[doom-package:php-refactor-mode]] - [[doom-package:phpunit]] -- if [[doom-module:+lsp]] - - [[doom-package:phpactor]] - - [[doom-package:company-phpactor]] ** Hacks /No hacks documented for this module./ diff --git a/modules/lang/php/config.el b/modules/lang/php/config.el index eb3a2512f..6cdda8ded 100644 --- a/modules/lang/php/config.el +++ b/modules/lang/php/config.el @@ -50,7 +50,7 @@ :yield "use") (if (not (modulep! +lsp)) - ;; `+php-company-backend' uses `company-phpactor', `php-extras-company' or + ;; `+php-company-backend' uses `php-extras-company' or ;; `company-dabbrev-code', in that order. (when +php--company-backends (set-company-backend! 'php-mode @@ -78,24 +78,6 @@ "s" #'phpunit-current-test)) -(use-package! phpactor - :unless (modulep! +lsp) - :after php-mode - :init - (add-to-list '+php--company-backends #'company-phpactor nil 'eq) - :config - (set-lookup-handlers! 'php-mode - :definition #'phpactor-goto-definition) - (map! :localleader - :map php-mode-map - :prefix ("r" . "refactor") - "cc" #'phpactor-copy-class - "mc" #'phpactor-move-class - "oi" #'phpactor-offset-info - "t" #'phpactor-transform - "ic" #'phpactor-import-class)) - - (use-package! php-refactor-mode :hook php-mode :config @@ -111,13 +93,12 @@ (use-package! php-extras :after php-mode :preface + (setq php-extras-eldoc-functions-file + (concat doom-profile-cache-dir "php-extras-eldoc-functions")) ;; We'll set up company support ourselves (advice-add #'php-extras-company-setup :override #'ignore) - :init (add-to-list '+php--company-backends #'php-extras-company) :config - (setq php-extras-eldoc-functions-file - (concat doom-data-dir "php-extras-eldoc-functions")) ;; Silence warning if `php-extras-eldoc-functions-file' hasn't finished ;; generating yet. (defun php-extras-load-eldoc () diff --git a/modules/lang/php/packages.el b/modules/lang/php/packages.el index 2b3f312fe..ce2dcb830 100644 --- a/modules/lang/php/packages.el +++ b/modules/lang/php/packages.el @@ -15,10 +15,5 @@ :recipe (:host github :repo "hhvm/hack-mode") :pin "ccf20511f0f2ed45d00d423c703bb91ab6a8b80c")) -(unless (modulep! +lsp) - (package! phpactor :pin "6b5269ff82785a9bd1e648b2f91e5128353d5a67") - (when (modulep! :completion company) - (package! company-phpactor :pin "6b5269ff82785a9bd1e648b2f91e5128353d5a67"))) - ;; For building php-extras (package! async :pin "cff2bd0be3c78a2eb76717eed60302972fe9b8c5") diff --git a/modules/lang/plantuml/config.el b/modules/lang/plantuml/config.el index 64ff4ed13..0d76e7887 100644 --- a/modules/lang/plantuml/config.el +++ b/modules/lang/plantuml/config.el @@ -3,15 +3,24 @@ (use-package! plantuml-mode :commands plantuml-download-jar :init - (setq plantuml-jar-path (concat doom-data-dir "plantuml.jar") - org-plantuml-jar-path plantuml-jar-path) + (setq plantuml-jar-path (concat doom-data-dir "plantuml.jar")) :config (set-popup-rule! "^\\*PLANTUML" :size 0.4 :select nil :ttl 0) - (setq plantuml-default-exec-mode (cond ((file-exists-p plantuml-jar-path) 'jar) - ((executable-find "plantuml") 'executable) - (plantuml-default-exec-mode)))) + ((executable-find plantuml-executable-path) 'executable) + (plantuml-default-exec-mode))) + ;; HACK: If plantuml-jar-path is missing at startup, then plantuml-mode will + ;; operate in another `plantuml-default-exec-mode'. After using + ;; plantuml-download-jar, we change it to `jar' just for this session. + (defadvice! +plantuml--use-downloaded-jar-a (fn &rest args) + "Configure plantuml-mode to use the downloaded jar for this session." + :around #'plantuml-download-jar + (let ((downloaded? (not (file-exists-p plantuml-jar-path)))) + (prog1 (apply fn args) + (when (and downloaded? (file-exists-p plantuml-jar-path)) + (setq org-plantuml-jar-path plantuml-jar-path + plantuml-default-exec-mode 'jar)))))) (use-package! flycheck-plantuml @@ -25,8 +34,14 @@ (after! ob-plantuml - ;; HACK Force ob-plantuml to use `plantuml-mode''s building mechanism, which - ;; is more sophisticated. + ;; The nested `after!' is needed to ensure `org-plantuml-jar-path's new + ;; default without overwriting any user config. + (after! plantuml-mode + (when (equal org-plantuml-jar-path "") + (setq org-plantuml-jar-path plantuml-jar-path))) + + ;; HACK: Force ob-plantuml to use `plantuml-mode''s building mechanism, which + ;; is more sophisticated. (advice-add #'org-babel-execute:plantuml :override #'+plantuml-org-babel-execute:plantuml-a) (add-to-list 'org-babel-default-header-args:plantuml diff --git a/modules/tools/lsp/+lsp.el b/modules/tools/lsp/+lsp.el index c82805ff4..e3f3988a2 100644 --- a/modules/tools/lsp/+lsp.el +++ b/modules/tools/lsp/+lsp.el @@ -84,6 +84,9 @@ Can be a list of backends; accepts any value `company-backends' accepts.") :implementations '(lsp-find-implementation :async t) :type-definition #'lsp-find-type-definition) + ;; HACK: See emacs-lsp/lsp-mode#3577 + (unless (modulep! :lang terraform) + (setq lsp-client-packages (delete 'lsp-terraform lsp-client-packages))) (defadvice! +lsp--respect-user-defined-checkers-a (fn &rest args) "Ensure user-defined `flycheck-checker' isn't overwritten by `lsp'." diff --git a/modules/tools/magit/packages.el b/modules/tools/magit/packages.el index ea1a2db1b..2d33c0142 100644 --- a/modules/tools/magit/packages.el +++ b/modules/tools/magit/packages.el @@ -1,12 +1,12 @@ ;; -*- no-byte-compile: t; -*- ;;; tools/magit/packages.el -;; NOTE: Always bump this to HEAD~1, not HEAD, because the latest commit on -;; magit's melpa branch is auto-generated and moved to HEAD every time there's -;; a commit to its main branch. +;; NOTE: Always bump magit and forge to HEAD~1, not HEAD, because the latest +;; commit on their melpa branches are auto-generated and moved to HEAD every +;; time there's a commit to its main branch. (package! magit :pin "2da34f1317c619ec2dfb9e0d969449261ca7f31f") (when (modulep! +forge) - (package! forge :pin "1e7ee99c7f76034e40210a6fd6007015b1998f6d") + (package! forge :pin "30f181f785522f2debf60945d6b589a65bc415f6") (package! code-review :recipe (:host github :repo "doomelpa/code-review" diff --git a/modules/ui/ligatures/config.el b/modules/ui/ligatures/config.el index d2bcdcec7..61cce4823 100644 --- a/modules/ui/ligatures/config.el +++ b/modules/ui/ligatures/config.el @@ -138,7 +138,10 @@ and cannot run in." (setq +ligatures--init-font-hook nil))) (when in-mode-extras-p (prependq! prettify-symbols-alist - (alist-get major-mode +ligatures-extra-alist))) + (or (alist-get major-mode +ligatures-extra-alist) + (cl-loop for (mode . symbols) in +ligatures-extra-alist + if (derived-mode-p mode) + return symbols)))) (when (and (or in-mode-p in-mode-extras-p) prettify-symbols-alist) (when prettify-symbols-mode diff --git a/modules/ui/vc-gutter/config.el b/modules/ui/vc-gutter/config.el index d54f44a50..dc1e053c9 100644 --- a/modules/ui/vc-gutter/config.el +++ b/modules/ui/vc-gutter/config.el @@ -192,5 +192,21 @@ Respects `diff-hl-disable-on-remote'." ;; triggered from Elisp's buffer API (from what I can tell). (defadvice! +vc-gutter--kill-diff-hl-thread-a (&optional buf) :before #'kill-buffer - (with-current-buffer (or buf (current-buffer)) - (+vc-gutter--kill-thread t)))) + (when-let ((buf (ignore-errors (window-normalize-buffer buf)))) + (with-current-buffer buf + (+vc-gutter--kill-thread t)))) + + ;; HACK: diff-hl won't be visible in TTY frames, but there's no simple way to + ;; use the fringe in GUI Emacs and use the margin in the terminal *AND* + ;; support daemon users, so we need more than a static `display-graphic-p' + ;; check at startup. + (when (modulep! :os tty) + (put 'diff-hl-mode 'last (display-graphic-p)) + (add-hook! 'doom-switch-window-hook + (defun +vc-gutter-use-margins-in-tty-h () + (let ((graphic? (display-graphic-p))) + (unless (and global-diff-hl-mode (eq (get 'diff-hl-mode 'last) graphic?)) + (global-diff-hl-mode -1) + (diff-hl-margin-mode (if graphic? -1 +1)) + (global-diff-hl-mode +1) + (put 'diff-hl-mode 'last graphic?))))))) diff --git a/modules/ui/workspaces/autoload/workspaces.el b/modules/ui/workspaces/autoload/workspaces.el index 39874bafa..46b5c00af 100644 --- a/modules/ui/workspaces/autoload/workspaces.el +++ b/modules/ui/workspaces/autoload/workspaces.el @@ -118,7 +118,7 @@ Returns t on success, nil otherwise." (unless (+workspace-exists-p name) (error "'%s' is an invalid workspace" name)) (let ((fname (expand-file-name +workspaces-data-file persp-save-dir))) - (persp-save-to-file-by-names fname *persp-hash* (list name)) + (persp-save-to-file-by-names fname *persp-hash* (list name) t) (and (member name (persp-list-persp-names-in-file fname)) t)))