From 9de821952043c90c6618c422bb7e48dfa91f1fd4 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Wed, 12 Nov 2025 17:33:00 +0300 Subject: [PATCH] emacs: update packages --- .config/yadm/hooks/run-tangle.el | 41 ++++++++++++++++++------- .emacs.d/modules/sqrt-general-config.el | 2 +- .emacs.d/modules/sqrt-general-org.el | 34 ++++++++++---------- .emacs.d/modules/sqrt-general-ui.el | 20 +++++++----- .emacs.d/modules/sqrt-tree-sitter.el | 1 + Arch.org | 18 +++++++++++ Emacs.org | 30 ++++++++++++------ 7 files changed, 100 insertions(+), 46 deletions(-) diff --git a/.config/yadm/hooks/run-tangle.el b/.config/yadm/hooks/run-tangle.el index a19b62d..3519ace 100644 --- a/.config/yadm/hooks/run-tangle.el +++ b/.config/yadm/hooks/run-tangle.el @@ -8,7 +8,7 @@ ;; Do not ask to confirm evaluations (setq org-confirm-babel-evaluate nil) -(defun my/extract-guix-dependencies (&optional category) +(defun my/extract-arch-dependencies (&optional category) (let ((dependencies '())) (org-table-map-tables (lambda () @@ -21,7 +21,7 @@ nil (mapcar #'substring-no-properties (nth 0 table)) :test (lambda (_ elem) - (string-match-p "[G|g]uix.*dep" elem)))) + (string-match-p "[A|a]rch.*dep" elem)))) (category-name-index (cl-position nil @@ -33,7 +33,13 @@ nil (mapcar #'substring-no-properties (nth 0 table)) :test (lambda (_ elem) - (string-match-p ".*[D|d]isabled.*" elem))))) + (string-match-p ".*[D|d]isabled.*" elem)))) + (source-index + (cl-position + nil + (mapcar #'substring-no-properties (nth 0 table)) + :test (lambda (_ elem) + (string-match-p ".*[S|s]ource.*" elem))))) (when dep-name-index (dolist (elem (cdr table)) (when @@ -53,15 +59,28 @@ (or (not disabled-name-index) (string-empty-p (nth disabled-name-index elem)))) - (add-to-list - 'dependencies - (substring-no-properties (nth dep-name-index elem))))))))) + (let ((source + (or + (when (and source-index + (not (string-empty-p (nth source-index elem)))) + (substring-no-properties + (nth source-index elem))) + "arch"))) + (push + (substring-no-properties (nth dep-name-index elem)) + (alist-get source dependencies nil nil #'equal))))))))) dependencies)) -(defun my/format-guix-dependencies (&optional category) - (mapconcat - (lambda (e) (concat "\"" e "\"")) - (my/extract-guix-dependencies category) - "\n")) +(defun my/format-arch-dependencies (&optional category) + (let ((data (my/extract-arch-dependencies category))) + (with-temp-buffer + (cl-loop for (backend . packages) in data + do (insert (format "%s = [\n" backend) + (mapconcat (lambda (package) + (format "\"%s\"," package)) + packages + "\n") + "]")) + (buffer-string)))) ;; A few dummy modes to avoid being prompted for comment systax (define-derived-mode fish-mode prog-mode "Fish" diff --git a/.emacs.d/modules/sqrt-general-config.el b/.emacs.d/modules/sqrt-general-config.el index 430d063..f0727f5 100644 --- a/.emacs.d/modules/sqrt-general-config.el +++ b/.emacs.d/modules/sqrt-general-config.el @@ -190,7 +190,7 @@ "m" 'magit "M" 'magit-file-dispatch) :config - (require 'forge) + ;; (require 'forge) (setq magit-blame-styles '((headings (heading-format . "%-20a %C %s\n")) diff --git a/.emacs.d/modules/sqrt-general-org.el b/.emacs.d/modules/sqrt-general-org.el index 07953cb..24edfd0 100644 --- a/.emacs.d/modules/sqrt-general-org.el +++ b/.emacs.d/modules/sqrt-general-org.el @@ -406,27 +406,28 @@ With ARG, repeats or can move backward if negative." (or (not disabled-name-index) (string-empty-p (nth disabled-name-index elem)))) - (add-to-list - 'dependencies - (cons - (substring-no-properties (nth dep-name-index elem)) - (when source-index - (let ((source (nth source-index elem))) - (unless (string-empty-p source) - source))))))))))) + (let ((source + (or + (when (and source-index + (not (string-empty-p (nth source-index elem)))) + (substring-no-properties + (nth source-index elem))) + "arch"))) + (push + (substring-no-properties (nth dep-name-index elem)) + (alist-get source dependencies nil nil #'equal))))))))) dependencies)) (defun my/format-arch-dependencies (&optional category) (let ((data (my/extract-arch-dependencies category))) (with-temp-buffer - (insert - (json-encode - (mapcar - (lambda (group) - (cons (car group) - (mapcar #'car (cdr group)))) - (seq-group-by #'cdr data)))) - (json-pretty-print-buffer) + (cl-loop for (backend . packages) in data + do (insert (format "%s = [\n" backend) + (mapconcat (lambda (package) + (format "\"%s\"," package)) + packages + "\n") + "]")) (buffer-string)))) (setq my/org-config-files @@ -435,6 +436,7 @@ With ARG, repeats or can move backward if negative." '("~/Emacs.org" "~/Desktop.org" "~/Console.org" + "~/Arch.org" "~/Guix.org" "~/Mail.org"))) diff --git a/.emacs.d/modules/sqrt-general-ui.el b/.emacs.d/modules/sqrt-general-ui.el index 18a0f55..42b94b6 100644 --- a/.emacs.d/modules/sqrt-general-ui.el +++ b/.emacs.d/modules/sqrt-general-ui.el @@ -77,8 +77,8 @@ (setq doom-themes-treemacs-theme "doom-colors") (doom-themes-treemacs-config)) -(use-package modus-themes - :straight t) +;; (use-package modus-themes +;; :straight (:build (:not native-compile))) (use-package ef-themes :straight t @@ -138,8 +138,8 @@ (defun my/modus-get-base (color) (let ((base-value (string-to-number (substring (symbol-name color) 4 5))) - (base-start (cadr (assoc 'bg-main (modus-themes--current-theme-palette)))) - (base-end (cadr (assoc 'fg-dim (modus-themes--current-theme-palette))))) + (base-start (cadr (assoc 'bg-main (modus-themes-get-theme-palette)))) + (base-end (cadr (assoc 'fg-dim (modus-themes-get-theme-palette))))) (nth base-value (ct-gradient 9 base-start base-end t)))) (defun my/prot-color (color palette) @@ -179,10 +179,10 @@ (t (cadr (assoc color palette)))))) (defun my/modus-color (color) - (my/prot-color color (modus-themes--current-theme-palette))) + (my/prot-color color (modus-themes-get-theme-palette))) (defun my/ef-color (color) - (my/prot-color color (ef-themes--current-theme-palette))) + (my/prot-color color (modus-themes-get-theme-palette))) (defconst my/test-colors-list '(black red green yellow blue magenta cyan white light-black @@ -250,9 +250,13 @@ collect (eval value))))))) (enable-theme 'my-theme-1)) +(defun my/advice-my-theme () + (advice-add 'load-theme :after #'my/update-my-theme)) + (unless my/is-termux - (advice-add 'load-theme :after #'my/update-my-theme) - (add-hook 'emacs-startup-hook #'my/update-my-theme)) + (add-hook 'emacs-startup-hook #'my/update-my-theme) + ;; (add-hook 'emacs-startup-hook #'my/advice-my-theme) +) (my/use-colors (tab-bar-tab :background (my/color-value 'bg) diff --git a/.emacs.d/modules/sqrt-tree-sitter.el b/.emacs.d/modules/sqrt-tree-sitter.el index f0946ed..0a4f301 100644 --- a/.emacs.d/modules/sqrt-tree-sitter.el +++ b/.emacs.d/modules/sqrt-tree-sitter.el @@ -92,6 +92,7 @@ (use-package combobulate :straight (:host github :repo "mickeynp/combobulate") + :disabled :commands (combobulate)) (provide 'sqrt-tree-sitter) diff --git a/Arch.org b/Arch.org index d557114..7a831f0 100644 --- a/Arch.org +++ b/Arch.org @@ -39,6 +39,7 @@ makepkg -si #+end_src Install [[https://github.com/ripytide/metapac][metapac]]: + #+begin_src bash paru -Syyu metapac #+end_src @@ -70,10 +71,27 @@ yadm clone git@github.com:SqrtMinusOne/dotfiles.git Checkout the changed files. Clone the org-mode repo: + #+begin_src bash git clone git@github.com:SqrtMinusOne/dotfiles.git "/home/pavel/30-39 Life/32 org-mode" #+end_src +Install wakatime: + +#+begin_src bash +cd ~/00-Scratch/ +git clone https://github.com/wakatime/wakatime-cli.git +cd ./wakatime-cli +go build +mv wakatime-cli ~/bin +#+end_src + +And create the =~/.wakatime.cfg= file with the following contents: +#+begin_src +[settings] +api_key = +#+end_src + Then run =emacs= and make sure it starts. * Metapac configuration diff --git a/Emacs.org b/Emacs.org index 759716b..e5a5087 100644 --- a/Emacs.org +++ b/Emacs.org @@ -242,6 +242,7 @@ So, first, specify how the modules are stored: #+end_src Then, scan =Emacs.org= for headings with the =MODULE_NAME= property and set the tangle property: + #+begin_src emacs-lisp (defun my/modules--refresh-and-list () (let (modules-list @@ -1541,7 +1542,7 @@ A few CLI alternatives: "m" 'magit "M" 'magit-file-dispatch) :config - (require 'forge) + ;; (require 'forge) (setq magit-blame-styles '((headings (heading-format . "%-20a %C %s\n")) @@ -2099,6 +2100,7 @@ Before I figure out how to package this for +Guix+ Arch: (advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path (or + (executable-find "wakatime") (executable-find "wakatime-cli") (expand-file-name "~/bin/wakatime-cli"))))) (when (file-exists-p "~/.wakatime.cfg") @@ -2276,8 +2278,8 @@ My colorschemes of choice. #+end_src #+begin_src emacs-lisp -(use-package modus-themes - :straight t) +;; (use-package modus-themes +;; :straight (:build (:not native-compile))) #+end_src Let's see... @@ -2364,8 +2366,8 @@ And the same for =modus-themes=. =my/modus-color= has to accept the same argumen #+begin_src emacs-lisp (defun my/modus-get-base (color) (let ((base-value (string-to-number (substring (symbol-name color) 4 5))) - (base-start (cadr (assoc 'bg-main (modus-themes--current-theme-palette)))) - (base-end (cadr (assoc 'fg-dim (modus-themes--current-theme-palette))))) + (base-start (cadr (assoc 'bg-main (modus-themes-get-theme-palette)))) + (base-end (cadr (assoc 'fg-dim (modus-themes-get-theme-palette))))) (nth base-value (ct-gradient 9 base-start base-end t)))) (defun my/prot-color (color palette) @@ -2405,10 +2407,10 @@ And the same for =modus-themes=. =my/modus-color= has to accept the same argumen (t (cadr (assoc color palette)))))) (defun my/modus-color (color) - (my/prot-color color (modus-themes--current-theme-palette))) + (my/prot-color color (modus-themes-get-theme-palette))) (defun my/ef-color (color) - (my/prot-color color (ef-themes--current-theme-palette))) + (my/prot-color color (modus-themes-get-theme-palette))) #+end_src Test the three functions. @@ -2493,9 +2495,13 @@ This macro puts lambdas to =my/my-theme-update-colors-hook= that updates faces i collect (eval value))))))) (enable-theme 'my-theme-1)) +(defun my/advice-my-theme () + (advice-add 'load-theme :after #'my/update-my-theme)) + (unless my/is-termux - (advice-add 'load-theme :after #'my/update-my-theme) - (add-hook 'emacs-startup-hook #'my/update-my-theme)) + (add-hook 'emacs-startup-hook #'my/update-my-theme) + ;; (add-hook 'emacs-startup-hook #'my/advice-my-theme) +) #+end_src Defining colors for =tab-bar.el=: @@ -2522,6 +2528,7 @@ The built-in =load-theme= does not deactivate the previous theme, so here's a fu (eq enabled-theme theme))) do (disable-theme enabled-theme)) (load-theme theme t) + (my/update-my-theme) (when current-prefix-arg (my/regenerate-desktop))) #+end_src @@ -3280,6 +3287,7 @@ I'm not actually using that, but its query editor is pretty useful to debug =tre #+begin_src emacs-lisp (use-package combobulate :straight (:host github :repo "mickeynp/combobulate") + :disabled :commands (combobulate)) #+end_src *** DAP @@ -8429,7 +8437,8 @@ Display icons for files. (string-match-p "/gnu/store" default-directory)) (nerd-icons-dired-mode)))) :config - (advice-add #'dired-create-empty-file :around #'nerd-icons-dired--refresh-advice)) + ;; (advice-add #'dired-create-empty-file :around #'nerd-icons-dired--refresh-advice) + ) #+end_src Provides stuff like =dired-open-xdg= @@ -9388,6 +9397,7 @@ Finally, a function that inserts the overlay in buffer if it's available and cal #+begin_src emacs-lisp (use-package eshell-atuin :straight (:host github :repo "SqrtMinusOne/eshell-atuin") + :when (executable-find "atuin") :after eshell :config (eshell-atuin-mode)