Trackpoint; Programming features

NixOS:
feat: enable Trackpoint customization
feat: make Zig, Go available
chore: remove obsolete Emacs code for Rust

Emacs:
feat: visual-line mode now enabled globally
fix: make rustic-mode work with tree-sitter
This commit is contained in:
Swarsel 2024-06-28 00:10:15 +02:00
parent 0e7daf0d13
commit ab4c219ab1
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
5 changed files with 68 additions and 131 deletions

View file

@ -1537,6 +1537,10 @@ Mostly just sets some opened ports for several games, enables virtualbox (which
];
};
bluetooth.enable = true;
trackpoint = {
enable = true;
device = "TPPS/2 Elan TrackPoint";
};
};
programs.steam = {
@ -4774,6 +4778,12 @@ Mostly used to install some compilers and lsp's that I want to have available wh
rust-analyzer
clippy
rustfmt
# go
go
gopls
# zig
zig
zls
# cpp
clang-tools
# + cuda
@ -8104,6 +8114,7 @@ Here I set up some things that are too minor to put under other categories.
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'text-mode-hook 'display-line-numbers-mode)
(global-visual-line-mode 1)
#+end_src
@ -8692,6 +8703,8 @@ The popper package allows to declare different buffers as 'popup-type', which so
"*scratch*"
"*julia*"
"*Python*"
"*rustic-compilation*"
"*cargo-run*"
;; ("*tex-shell*" . hide)
(compilation-mode . hide)))
(popper-mode +1)
@ -8704,6 +8717,8 @@ The popper package allows to declare different buffers as 'popup-type', which so
("*Occur*" :select t :popup t :align below :size 0.2)
("*scratch*" :select t :popup t :align below :size 0.2)
("*Python*" :select t :popup t :align below :size 0.2)
("*rustic-compilation*" :select t :popup t :align below :size 0.4)
("*cargo-run*" :select t :popup t :align below :size 0.2)
("*tex-shell*" :ignore t :popup t :align below :size 0.2)
(helpful-mode :select t :popup t :align right :size 0.35)
(help-mode :select t :popup t :align right :size 0.4)))
@ -9361,7 +9376,7 @@ In order to update the language grammars, run the next command below.
#+end_src
*** direnv
*** direnv (envrc)
:PROPERTIES:
:CUSTOM_ID: h:82ddeef2-99f8-465b-ba36-07c3eaad717b
:END:
@ -9698,45 +9713,13 @@ I leave the commented out alist extensions here in case I want to try them out a
:CUSTOM_ID: h:3aa20438-edf6-4b13-a90d-3d5c51239c44
:END:
This is supposed to setup a rust-lsp - however, this has not worked nicely in the past and this configuration section is just a ruin really. I need to check what works and clean this up.
This sets up rustic-mode with tree-sitter support - there is still one issue to iron out with automatic adding of dependency crates, but everything else works fine now.
#+begin_src emacs-lisp
;; (use-package rustic
;; :ensure
;; :bind (:map rustic-mode-map
;; ("M-j" . lsp-ui-imenu)
;; ("M-?" . lsp-find-references)
;; ("C-c C-c l" . flycheck-list-errors)
;; ("C-c C-c a" . lsp-execute-code-action)
;; ("C-c C-c r" . lsp-rename)
;; ("C-c C-c q" . lsp-workspace-restart)
;; ("C-c C-c Q" . lsp-workspace-shutdown)
;; ("C-c C-c s" . lsp-rust-analyzer-status))
;; :config
;; (setq rustic-format-on-save t)
;; (add-hook 'rustic-mode-hook 'rk/rustic-mode-hook))
;; (defun rk/rustic-mode-hook ()
;; ;; so that run C-c C-c C-r works without having to confirm, but don't try to
;; ;; save rust buffers that are not file visiting. Once
;; ;; https://github.com/brotzeit/rustic/issues/253 has been resolved this should
;; ;; no longer be necessary.
;; (when buffer-file-name
;; (setq-local buffer-save-without-query t))
;; (add-hook 'before-save-hook 'lsp-format-buffer nil t))
;; (use-package rustic
;; :config
;; (setq rustic-format-on-save t)
;; (setq rustic-lsp-client 'eglot)
;; :custom
;; (lsp-rust-analyzer-cargo-watch-command "clippy")
;; (lsp-rust-analyzer-server-display-inlay-hints t)
;; :mode ("\\.rs" . rustic-mode))
(use-package rustic
:init
(setq rust-mode-treesitter-derive t)
:config
(setq rustic-format-on-save t)
(setq rustic-lsp-client 'eglot)
@ -9899,7 +9882,7 @@ The following block is mostly inspired from [[https://code.kulupu.party/thesuess
:CUSTOM_ID: h:316857e7-4df8-4ec5-b22e-6dac918fa937
:END:
After having tried out =lsp-mode= and =lsp-bridge= for a while each, I must say that =eglot= feels the most clean and fast to me. Rust-modes need a little extra care to get working here.
After having tried out =lsp-mode= and =lsp-bridge= for a while each, I must say that =eglot= feels the most clean and fast to me.
:PROPERTIES:
:CUSTOM_ID: h:424fbc62-84e2-42c7-a1ca-e43ea04c43e5
@ -9916,6 +9899,8 @@ After having tried out =lsp-mode= and =lsp-bridge= for a while each, I must say
c-ts-mode
c++-mode
c++-ts-mode
rustic-mode
rust-ts-mode
tex-mode
LaTeX-mode
) . (lambda () (progn
@ -9924,12 +9909,6 @@ After having tried out =lsp-mode= and =lsp-bridge= for a while each, I must say
:custom
(eldoc-echo-area-use-multiline-p nil)
(completion-category-defaults nil)
:config
;; (push '(rustic-ts-mode . eglot-rust-analyzer) eglot-server-programs)
(push '(rustic-mode . eglot-rust-analyzer) eglot-server-programs)
(add-to-list 'eglot-server-programs '((rust-mode) . (eglot-rust-analyzer "rust-analyzer")))
;; (add-to-list 'eglot-server-programs '((python-mode) . ("pylsp")))
;; (add-to-list 'eglot-server-programs '((c-mode) . ("clangd")))
:bind (:map eglot-mode-map
("M-(" . flymake-goto-next-error)
("C-c ," . eglot-code-actions)))

View file

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2024-06-20 Do 18:10 -->
<!-- 2024-06-28 Fr 00:09 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SwarselSystems: NixOS + Emacs Configuration</title>
@ -332,7 +332,7 @@
<li><a href="#h:94d4a0dc-b0d7-4702-b760-beeaa6da2b8f">4.4.5. darkroom</a></li>
<li><a href="#h:87453f1c-8ea5-4d0a-862d-8973d5bc5405">4.4.6. Ripgrep</a></li>
<li><a href="#h:543641d0-02a9-459e-a2d6-96c8fcc06864">4.4.7. Tree-sitter</a></li>
<li><a href="#h:82ddeef2-99f8-465b-ba36-07c3eaad717b">4.4.8. direnv</a></li>
<li><a href="#h:82ddeef2-99f8-465b-ba36-07c3eaad717b">4.4.8. direnv (envrc)</a></li>
<li><a href="#h:efb3f0fd-e846-4df9-ba48-2e45d776f68f">4.4.9. avy</a></li>
<li><a href="#h:1c1821c6-98de-4079-a4f3-6ba6e6dcb668">4.4.10. crdt (Collaborative Editing)</a></li>
<li><a href="#h:d9a6cb44-736e-4608-951f-e928e1b757c0">4.4.11. devdocs</a></li>
@ -369,7 +369,7 @@
</div>
</div>
<p>
<b>This file has 40644 words spanning 10489 lines and was last revised on 2024-06-20 18:10:32 +0200.</b>
<b>This file has 40441 words spanning 10468 lines and was last revised on 2024-06-28 00:09:44 +0200.</b>
</p>
<p>
@ -419,7 +419,7 @@ This section defines my Emacs configuration. For a while, I considered to use ry
</p>
<p>
My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-06-20 18:10:32 +0200)
My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-06-28 00:09:44 +0200)
</p></li>
</ul>
@ -2463,6 +2463,10 @@ Mostly just sets some opened ports for several games, enables virtualbox (which
];
};
bluetooth.enable = true;
trackpoint = {
enable = true;
device = "TPPS/2 Elan TrackPoint";
};
};
programs.steam = {
@ -5971,6 +5975,12 @@ environment.systemPackages = with pkgs; [
rust-analyzer
clippy
rustfmt
# go
go
gopls
# zig
zig
zls
# cpp
clang-tools
# + cuda
@ -9868,6 +9878,7 @@ Here I set up some things that are too minor to put under other categories.
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'text-mode-hook 'display-line-numbers-mode)
(global-visual-line-mode 1)
</pre>
</div>
@ -10543,6 +10554,8 @@ The popper package allows to declare different buffers as 'popup-type', which so
"*scratch*"
"*julia*"
"*Python*"
"*rustic-compilation*"
"*cargo-run*"
;; ("*tex-shell*" . hide)
(compilation-mode . hide)))
(popper-mode +1)
@ -10555,6 +10568,8 @@ The popper package allows to declare different buffers as 'popup-type', which so
("*Occur*" :select t :popup t :align below :size 0.2)
("*scratch*" :select t :popup t :align below :size 0.2)
("*Python*" :select t :popup t :align below :size 0.2)
("*rustic-compilation*" :select t :popup t :align below :size 0.4)
("*cargo-run*" :select t :popup t :align below :size 0.2)
("*tex-shell*" :ignore t :popup t :align below :size 0.2)
(helpful-mode :select t :popup t :align right :size 0.35)
(help-mode :select t :popup t :align right :size 0.4)))
@ -11291,7 +11306,7 @@ In order to update the language grammars, run the next command below.
</div>
<div id="outline-container-h:82ddeef2-99f8-465b-ba36-07c3eaad717b" class="outline-4">
<h4 id="h:82ddeef2-99f8-465b-ba36-07c3eaad717b"><span class="section-number-4">4.4.8.</span> direnv</h4>
<h4 id="h:82ddeef2-99f8-465b-ba36-07c3eaad717b"><span class="section-number-4">4.4.8.</span> direnv (envrc)</h4>
<div class="outline-text-4" id="text-h:82ddeef2-99f8-465b-ba36-07c3eaad717b">
<div class="org-src-container">
<pre class="src src-emacs-lisp">
@ -11678,46 +11693,14 @@ I leave the commented out alist extensions here in case I want to try them out a
<h4 id="h:3aa20438-edf6-4b13-a90d-3d5c51239c44"><span class="section-number-4">4.4.20.</span> rust</h4>
<div class="outline-text-4" id="text-h:3aa20438-edf6-4b13-a90d-3d5c51239c44">
<p>
This is supposed to setup a rust-lsp - however, this has not worked nicely in the past and this configuration section is just a ruin really. I need to check what works and clean this up.
This sets up rustic-mode with tree-sitter support - there is still one issue to iron out with automatic adding of dependency crates, but everything else works fine now.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">
;; (use-package rustic
;; :ensure
;; :bind (:map rustic-mode-map
;; ("M-j" . lsp-ui-imenu)
;; ("M-?" . lsp-find-references)
;; ("C-c C-c l" . flycheck-list-errors)
;; ("C-c C-c a" . lsp-execute-code-action)
;; ("C-c C-c r" . lsp-rename)
;; ("C-c C-c q" . lsp-workspace-restart)
;; ("C-c C-c Q" . lsp-workspace-shutdown)
;; ("C-c C-c s" . lsp-rust-analyzer-status))
;; :config
;; (setq rustic-format-on-save t)
;; (add-hook 'rustic-mode-hook 'rk/rustic-mode-hook))
;; (defun rk/rustic-mode-hook ()
;; ;; so that run C-c C-c C-r works without having to confirm, but don't try to
;; ;; save rust buffers that are not file visiting. Once
;; ;; https://github.com/brotzeit/rustic/issues/253 has been resolved this should
;; ;; no longer be necessary.
;; (when buffer-file-name
;; (setq-local buffer-save-without-query t))
;; (add-hook 'before-save-hook 'lsp-format-buffer nil t))
;; (use-package rustic
;; :config
;; (setq rustic-format-on-save t)
;; (setq rustic-lsp-client 'eglot)
;; :custom
;; (lsp-rust-analyzer-cargo-watch-command "clippy")
;; (lsp-rust-analyzer-server-display-inlay-hints t)
;; :mode ("\\.rs" . rustic-mode))
(use-package rustic
:init
(setq rust-mode-treesitter-derive t)
:config
(setq rustic-format-on-save t)
(setq rustic-lsp-client 'eglot)
@ -11902,7 +11885,7 @@ The following block is mostly inspired from <a href="https://code.kulupu.party/t
<h4 id="h:316857e7-4df8-4ec5-b22e-6dac918fa937"><span class="section-number-4">4.4.25.</span> eglot</h4>
<div class="outline-text-4" id="text-h:316857e7-4df8-4ec5-b22e-6dac918fa937">
<p>
After having tried out <code>lsp-mode</code> and <code>lsp-bridge</code> for a while each, I must say that <code>eglot</code> feels the most clean and fast to me. Rust-modes need a little extra care to get working here.
After having tried out <code>lsp-mode</code> and <code>lsp-bridge</code> for a while each, I must say that <code>eglot</code> feels the most clean and fast to me.
</p>
<p>
@ -11920,6 +11903,8 @@ After having tried out <code>lsp-mode</code> and <code>lsp-bridge</code> for a w
c-ts-mode
c++-mode
c++-ts-mode
rustic-mode
rust-ts-mode
tex-mode
LaTeX-mode
) . (lambda () (progn
@ -11928,12 +11913,6 @@ After having tried out <code>lsp-mode</code> and <code>lsp-bridge</code> for a w
:custom
(eldoc-echo-area-use-multiline-p nil)
(completion-category-defaults nil)
:config
;; (push '(rustic-ts-mode . eglot-rust-analyzer) eglot-server-programs)
(push '(rustic-mode . eglot-rust-analyzer) eglot-server-programs)
(add-to-list 'eglot-server-programs '((rust-mode) . (eglot-rust-analyzer "rust-analyzer")))
;; (add-to-list 'eglot-server-programs '((python-mode) . ("pylsp")))
;; (add-to-list 'eglot-server-programs '((c-mode) . ("clangd")))
:bind (:map eglot-mode-map
("M-(" . flymake-goto-next-error)
("C-c ," . eglot-code-actions)))
@ -12567,7 +12546,7 @@ This sets up the <code>dashboard</code>, which is really quite useless. But, it
</div>
<div id="postamble" class="status">
<p class="author">Author: Leon Schwarzäugl</p>
<p class="date">Created: 2024-06-20 Do 18:10</p>
<p class="date">Created: 2024-06-28 Fr 00:09</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View file

@ -108,6 +108,12 @@ environment.systemPackages = with pkgs; [
rust-analyzer
clippy
rustfmt
# go
go
gopls
# zig
zig
zls
# cpp
clang-tools
# + cuda

View file

@ -115,6 +115,10 @@
];
};
bluetooth.enable = true;
trackpoint = {
enable = true;
device = "TPPS/2 Elan TrackPoint";
};
};
programs.steam = {

View file

@ -444,6 +444,7 @@ create a new one."
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'text-mode-hook 'display-line-numbers-mode)
(global-visual-line-mode 1)
(setq custom-safe-themes t)
@ -726,6 +727,8 @@ create a new one."
"*scratch*"
"*julia*"
"*Python*"
"*rustic-compilation*"
"*cargo-run*"
;; ("*tex-shell*" . hide)
(compilation-mode . hide)))
(popper-mode +1)
@ -738,6 +741,8 @@ create a new one."
("*Occur*" :select t :popup t :align below :size 0.2)
("*scratch*" :select t :popup t :align below :size 0.2)
("*Python*" :select t :popup t :align below :size 0.2)
("*rustic-compilation*" :select t :popup t :align below :size 0.4)
("*cargo-run*" :select t :popup t :align below :size 0.2)
("*tex-shell*" :ignore t :popup t :align below :size 0.2)
(helpful-mode :select t :popup t :align right :size 0.35)
(help-mode :select t :popup t :align right :size 0.4)))
@ -1277,41 +1282,9 @@ create a new one."
;; (add-to-list 'completion-at-point-functions #'cape-line)
)
;; (use-package rustic
;; :ensure
;; :bind (:map rustic-mode-map
;; ("M-j" . lsp-ui-imenu)
;; ("M-?" . lsp-find-references)
;; ("C-c C-c l" . flycheck-list-errors)
;; ("C-c C-c a" . lsp-execute-code-action)
;; ("C-c C-c r" . lsp-rename)
;; ("C-c C-c q" . lsp-workspace-restart)
;; ("C-c C-c Q" . lsp-workspace-shutdown)
;; ("C-c C-c s" . lsp-rust-analyzer-status))
;; :config
;; (setq rustic-format-on-save t)
;; (add-hook 'rustic-mode-hook 'rk/rustic-mode-hook))
;; (defun rk/rustic-mode-hook ()
;; ;; so that run C-c C-c C-r works without having to confirm, but don't try to
;; ;; save rust buffers that are not file visiting. Once
;; ;; https://github.com/brotzeit/rustic/issues/253 has been resolved this should
;; ;; no longer be necessary.
;; (when buffer-file-name
;; (setq-local buffer-save-without-query t))
;; (add-hook 'before-save-hook 'lsp-format-buffer nil t))
;; (use-package rustic
;; :config
;; (setq rustic-format-on-save t)
;; (setq rustic-lsp-client 'eglot)
;; :custom
;; (lsp-rust-analyzer-cargo-watch-command "clippy")
;; (lsp-rust-analyzer-server-display-inlay-hints t)
;; :mode ("\\.rs" . rustic-mode))
(use-package rustic
:init
(setq rust-mode-treesitter-derive t)
:config
(setq rustic-format-on-save t)
(setq rustic-lsp-client 'eglot)
@ -1413,6 +1386,8 @@ create a new one."
c-ts-mode
c++-mode
c++-ts-mode
rustic-mode
rust-ts-mode
tex-mode
LaTeX-mode
) . (lambda () (progn
@ -1421,12 +1396,6 @@ create a new one."
:custom
(eldoc-echo-area-use-multiline-p nil)
(completion-category-defaults nil)
:config
;; (push '(rustic-ts-mode . eglot-rust-analyzer) eglot-server-programs)
(push '(rustic-mode . eglot-rust-analyzer) eglot-server-programs)
(add-to-list 'eglot-server-programs '((rust-mode) . (eglot-rust-analyzer "rust-analyzer")))
;; (add-to-list 'eglot-server-programs '((python-mode) . ("pylsp")))
;; (add-to-list 'eglot-server-programs '((c-mode) . ("clangd")))
:bind (:map eglot-mode-map
("M-(" . flymake-goto-next-error)
("C-c ," . eglot-code-actions)))