emacs: update packages

This commit is contained in:
Pavel Korytov 2025-11-12 17:33:00 +03:00
parent 31db63c565
commit 9de8219520
7 changed files with 100 additions and 46 deletions

View file

@ -8,7 +8,7 @@
;; Do not ask to confirm evaluations ;; Do not ask to confirm evaluations
(setq org-confirm-babel-evaluate nil) (setq org-confirm-babel-evaluate nil)
(defun my/extract-guix-dependencies (&optional category) (defun my/extract-arch-dependencies (&optional category)
(let ((dependencies '())) (let ((dependencies '()))
(org-table-map-tables (org-table-map-tables
(lambda () (lambda ()
@ -21,7 +21,7 @@
nil nil
(mapcar #'substring-no-properties (nth 0 table)) (mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem) :test (lambda (_ elem)
(string-match-p "[G|g]uix.*dep" elem)))) (string-match-p "[A|a]rch.*dep" elem))))
(category-name-index (category-name-index
(cl-position (cl-position
nil nil
@ -33,7 +33,13 @@
nil nil
(mapcar #'substring-no-properties (nth 0 table)) (mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem) :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 (when dep-name-index
(dolist (elem (cdr table)) (dolist (elem (cdr table))
(when (when
@ -53,15 +59,28 @@
(or (or
(not disabled-name-index) (not disabled-name-index)
(string-empty-p (nth disabled-name-index elem)))) (string-empty-p (nth disabled-name-index elem))))
(add-to-list (let ((source
'dependencies (or
(substring-no-properties (nth dep-name-index elem))))))))) (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)) dependencies))
(defun my/format-guix-dependencies (&optional category) (defun my/format-arch-dependencies (&optional category)
(mapconcat (let ((data (my/extract-arch-dependencies category)))
(lambda (e) (concat "\"" e "\"")) (with-temp-buffer
(my/extract-guix-dependencies category) (cl-loop for (backend . packages) in data
"\n")) 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 ;; A few dummy modes to avoid being prompted for comment systax
(define-derived-mode fish-mode prog-mode "Fish" (define-derived-mode fish-mode prog-mode "Fish"

View file

@ -190,7 +190,7 @@
"m" 'magit "m" 'magit
"M" 'magit-file-dispatch) "M" 'magit-file-dispatch)
:config :config
(require 'forge) ;; (require 'forge)
(setq magit-blame-styles (setq magit-blame-styles
'((headings '((headings
(heading-format . "%-20a %C %s\n")) (heading-format . "%-20a %C %s\n"))

View file

@ -406,27 +406,28 @@ With ARG, repeats or can move backward if negative."
(or (or
(not disabled-name-index) (not disabled-name-index)
(string-empty-p (nth disabled-name-index elem)))) (string-empty-p (nth disabled-name-index elem))))
(add-to-list (let ((source
'dependencies (or
(cons (when (and source-index
(substring-no-properties (nth dep-name-index elem)) (not (string-empty-p (nth source-index elem))))
(when source-index (substring-no-properties
(let ((source (nth source-index elem))) (nth source-index elem)))
(unless (string-empty-p source) "arch")))
source))))))))))) (push
(substring-no-properties (nth dep-name-index elem))
(alist-get source dependencies nil nil #'equal)))))))))
dependencies)) dependencies))
(defun my/format-arch-dependencies (&optional category) (defun my/format-arch-dependencies (&optional category)
(let ((data (my/extract-arch-dependencies category))) (let ((data (my/extract-arch-dependencies category)))
(with-temp-buffer (with-temp-buffer
(insert (cl-loop for (backend . packages) in data
(json-encode do (insert (format "%s = [\n" backend)
(mapcar (mapconcat (lambda (package)
(lambda (group) (format "\"%s\"," package))
(cons (car group) packages
(mapcar #'car (cdr group)))) "\n")
(seq-group-by #'cdr data)))) "]"))
(json-pretty-print-buffer)
(buffer-string)))) (buffer-string))))
(setq my/org-config-files (setq my/org-config-files
@ -435,6 +436,7 @@ With ARG, repeats or can move backward if negative."
'("~/Emacs.org" '("~/Emacs.org"
"~/Desktop.org" "~/Desktop.org"
"~/Console.org" "~/Console.org"
"~/Arch.org"
"~/Guix.org" "~/Guix.org"
"~/Mail.org"))) "~/Mail.org")))

View file

@ -77,8 +77,8 @@
(setq doom-themes-treemacs-theme "doom-colors") (setq doom-themes-treemacs-theme "doom-colors")
(doom-themes-treemacs-config)) (doom-themes-treemacs-config))
(use-package modus-themes ;; (use-package modus-themes
:straight t) ;; :straight (:build (:not native-compile)))
(use-package ef-themes (use-package ef-themes
:straight t :straight t
@ -138,8 +138,8 @@
(defun my/modus-get-base (color) (defun my/modus-get-base (color)
(let ((base-value (string-to-number (substring (symbol-name color) 4 5))) (let ((base-value (string-to-number (substring (symbol-name color) 4 5)))
(base-start (cadr (assoc 'bg-main (modus-themes--current-theme-palette)))) (base-start (cadr (assoc 'bg-main (modus-themes-get-theme-palette))))
(base-end (cadr (assoc 'fg-dim (modus-themes--current-theme-palette))))) (base-end (cadr (assoc 'fg-dim (modus-themes-get-theme-palette)))))
(nth base-value (ct-gradient 9 base-start base-end t)))) (nth base-value (ct-gradient 9 base-start base-end t))))
(defun my/prot-color (color palette) (defun my/prot-color (color palette)
@ -179,10 +179,10 @@
(t (cadr (assoc color palette)))))) (t (cadr (assoc color palette))))))
(defun my/modus-color (color) (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) (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 (defconst my/test-colors-list
'(black red green yellow blue magenta cyan white light-black '(black red green yellow blue magenta cyan white light-black
@ -250,9 +250,13 @@
collect (eval value))))))) collect (eval value)))))))
(enable-theme 'my-theme-1)) (enable-theme 'my-theme-1))
(defun my/advice-my-theme ()
(advice-add 'load-theme :after #'my/update-my-theme))
(unless my/is-termux (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 (my/use-colors
(tab-bar-tab :background (my/color-value 'bg) (tab-bar-tab :background (my/color-value 'bg)

View file

@ -92,6 +92,7 @@
(use-package combobulate (use-package combobulate
:straight (:host github :repo "mickeynp/combobulate") :straight (:host github :repo "mickeynp/combobulate")
:disabled
:commands (combobulate)) :commands (combobulate))
(provide 'sqrt-tree-sitter) (provide 'sqrt-tree-sitter)

View file

@ -39,6 +39,7 @@ makepkg -si
#+end_src #+end_src
Install [[https://github.com/ripytide/metapac][metapac]]: Install [[https://github.com/ripytide/metapac][metapac]]:
#+begin_src bash #+begin_src bash
paru -Syyu metapac paru -Syyu metapac
#+end_src #+end_src
@ -70,10 +71,27 @@ yadm clone git@github.com:SqrtMinusOne/dotfiles.git
Checkout the changed files. Checkout the changed files.
Clone the org-mode repo: Clone the org-mode repo:
#+begin_src bash #+begin_src bash
git clone git@github.com:SqrtMinusOne/dotfiles.git "/home/pavel/30-39 Life/32 org-mode" git clone git@github.com:SqrtMinusOne/dotfiles.git "/home/pavel/30-39 Life/32 org-mode"
#+end_src #+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 = <api-key>
#+end_src
Then run =emacs= and make sure it starts. Then run =emacs= and make sure it starts.
* Metapac configuration * Metapac configuration

View file

@ -242,6 +242,7 @@ So, first, specify how the modules are stored:
#+end_src #+end_src
Then, scan =Emacs.org= for headings with the =MODULE_NAME= property and set the tangle property: Then, scan =Emacs.org= for headings with the =MODULE_NAME= property and set the tangle property:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun my/modules--refresh-and-list () (defun my/modules--refresh-and-list ()
(let (modules-list (let (modules-list
@ -1541,7 +1542,7 @@ A few CLI alternatives:
"m" 'magit "m" 'magit
"M" 'magit-file-dispatch) "M" 'magit-file-dispatch)
:config :config
(require 'forge) ;; (require 'forge)
(setq magit-blame-styles (setq magit-blame-styles
'((headings '((headings
(heading-format . "%-20a %C %s\n")) (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 (advice-add 'wakatime-init :after
(lambda () (lambda ()
(setq wakatime-cli-path (or (setq wakatime-cli-path (or
(executable-find "wakatime")
(executable-find "wakatime-cli") (executable-find "wakatime-cli")
(expand-file-name "~/bin/wakatime-cli"))))) (expand-file-name "~/bin/wakatime-cli")))))
(when (file-exists-p "~/.wakatime.cfg") (when (file-exists-p "~/.wakatime.cfg")
@ -2276,8 +2278,8 @@ My colorschemes of choice.
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package modus-themes ;; (use-package modus-themes
:straight t) ;; :straight (:build (:not native-compile)))
#+end_src #+end_src
Let's see... 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 #+begin_src emacs-lisp
(defun my/modus-get-base (color) (defun my/modus-get-base (color)
(let ((base-value (string-to-number (substring (symbol-name color) 4 5))) (let ((base-value (string-to-number (substring (symbol-name color) 4 5)))
(base-start (cadr (assoc 'bg-main (modus-themes--current-theme-palette)))) (base-start (cadr (assoc 'bg-main (modus-themes-get-theme-palette))))
(base-end (cadr (assoc 'fg-dim (modus-themes--current-theme-palette))))) (base-end (cadr (assoc 'fg-dim (modus-themes-get-theme-palette)))))
(nth base-value (ct-gradient 9 base-start base-end t)))) (nth base-value (ct-gradient 9 base-start base-end t))))
(defun my/prot-color (color palette) (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)))))) (t (cadr (assoc color palette))))))
(defun my/modus-color (color) (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) (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 #+end_src
Test the three functions. 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))))))) collect (eval value)))))))
(enable-theme 'my-theme-1)) (enable-theme 'my-theme-1))
(defun my/advice-my-theme ()
(advice-add 'load-theme :after #'my/update-my-theme))
(unless my/is-termux (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 #+end_src
Defining colors for =tab-bar.el=: 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))) (eq enabled-theme theme)))
do (disable-theme enabled-theme)) do (disable-theme enabled-theme))
(load-theme theme t) (load-theme theme t)
(my/update-my-theme)
(when current-prefix-arg (when current-prefix-arg
(my/regenerate-desktop))) (my/regenerate-desktop)))
#+end_src #+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 #+begin_src emacs-lisp
(use-package combobulate (use-package combobulate
:straight (:host github :repo "mickeynp/combobulate") :straight (:host github :repo "mickeynp/combobulate")
:disabled
:commands (combobulate)) :commands (combobulate))
#+end_src #+end_src
*** DAP *** DAP
@ -8429,7 +8437,8 @@ Display icons for files.
(string-match-p "/gnu/store" default-directory)) (string-match-p "/gnu/store" default-directory))
(nerd-icons-dired-mode)))) (nerd-icons-dired-mode))))
:config :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 #+end_src
Provides stuff like =dired-open-xdg= 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 #+begin_src emacs-lisp
(use-package eshell-atuin (use-package eshell-atuin
:straight (:host github :repo "SqrtMinusOne/eshell-atuin") :straight (:host github :repo "SqrtMinusOne/eshell-atuin")
:when (executable-find "atuin")
:after eshell :after eshell
:config :config
(eshell-atuin-mode) (eshell-atuin-mode)