commit c5937a0e56bede4fa6003e8e42ecaf6164fb38b7
parent 18b94ec063a25d4644569dfe3c66c003f8057a19
Author: Michael Neuper <michael@michaelneuper.com>
Date: Mon, 18 May 2026 13:36:43 +0200
configure rust +eglot
Diffstat:
| M | config.org | | | 51 | +++++++++++++++++++++++++++++++++++++++++++++++---- |
| M | init.el | | | 6 | +++--- |
2 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/config.org b/config.org
@@ -1088,6 +1088,13 @@ If prefix ARG is non-nil, cd into `default-directory' instead of project root."
#+begin_src emacs-lisp
(setq eros-eval-result-prefix "⇒ ") ;; or use ⟹
#+end_src
+*** lookup
+Prevent those annoying popups from resizing the echo area.
+#+begin_src emacs-lisp
+(after! eldoc
+ (setq eldoc-echo-area-use-multiline-p nil))
+#+end_src
+
*** llm
#+begin_src emacs-lisp
(defvar my/llm-sidebar-width 0.4
@@ -1365,15 +1372,38 @@ Toggle a workspace-local Codex sidebar.
By default =eglot-code-action-indicator= is set to a lightbulb emoji (💡) which
annoyingly causes the line height to increase when hovering over certain things on macOS,
let's change this to a nerd font light bulb instead.
+
+Also disable inlay hints.
#+begin_src emacs-lisp
(after! eglot
- (setq eglot-code-action-indicator "")
+ (setq eglot-code-action-indicator ""
+ eglot-ignored-server-capabilities ;; disable some intrusive features
+ '(:documentHighlightProvider
+ :documentOnTypeFormattingProvider))
+
+ (defadvice! +eglot--no-auto-inlay-hints-a (fn)
+ "Prevent eglot from auto-enabling inlay hints on activation."
+ :around #'eglot--maybe-activate-editing-mode
+ (let ((orig (symbol-function 'eglot-inlay-hints-mode)))
+ (cl-letf (((symbol-function 'eglot-inlay-hints-mode)
+ (lambda (n) (when (< n 1) (funcall orig n)))))
+ (funcall fn))))
(custom-set-faces!
- `(eglot-inlay-hint-face
+ `(eglot-inlay-hint-face ;; FIXME background does not change when selected
:foreground ,(doom-color 'base5)
- :height 0.9))
- ;; :family ,my/sans-serif-font))
+ :height 0.9)
+ '((eglot-semantic-definition
+ eglot-semantic-declaration
+ eglot-semantic-static
+ eglot-semantic-defaultLibrary)
+ :foreground unspecified)
+ `(eglot-semantic-operator :foreground ,(doom-color 'cyan))
+ `(eglot-semantic-namespace :foreground ,(doom-color 'violet))
+ '(eglot-semantic-comment :slant italic)
+ '(eglot-semantic-documentation :slant normal)
+ '(eglot-semantic-defaultLibrary :weight bold)
+ '(eglot-semantic-macro :weight normal))
(map! :map eglot-mode-map
:leader
@@ -1485,6 +1515,19 @@ Install with ~npm install -g pyright~.
(setq python-shell-interpreter "python3.11"
doom-modeline-env-python-executable "python3.11"))
#+end_src
+*** rust +lsp
+Eglot receives Rust-specific semantic tokens like ~lifetime~, but it only
+defines faces for standard LSP token types, so add the missing Rust ones.
+#+begin_src emacs-lisp
+(after! eglot
+ (defface eglot-semantic-lifetime
+ `((t (:foreground ,(doom-color 'fg-alt) :slant italic)))
+ "Face for Rust lifetime semantic tokens."
+ :group 'eglot-semantic-faces)
+
+ (dolist (token '("lifetime" "macro"))
+ (add-to-list 'eglot-semantic-token-types token)))
+#+end_src
*** latex +cdlatex
Enable auomatic insertion of braces after sub/superscript in =LaTeX-math-mode=.
This used to the default behaviour in doom but was changed in commit [[https://github.com/doomemacs/doomemacs/commit/57fcd95e7dd61fcfc235293d7909e7b008466113][57fcd95]].
diff --git a/init.el b/init.el
@@ -70,7 +70,7 @@
vterm ; the best terminal emulation in Emacs
:checkers
- (syntax +childframe +flymake +icons) ; tasing you for every semicolon you forget
+ (syntax +flymake +icons) ; tasing you for every semicolon you forget
;;(spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
@@ -84,7 +84,7 @@
editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
- lookup ; navigate your code and its documentation
+ (lookup +docsets) ; navigate your code and its documentation
llm ; when I said you needed friends, I didn't mean...
(lsp +eglot +booster) ; M-x vscode
magit ; a git porcelain for Emacs
@@ -153,7 +153,7 @@
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
- rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
+ (rust +lsp +tree-sitter) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps
(sh +tree-sitter) ; she sells {ba,z,fi}sh shells on the C xor