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
(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"

View file

@ -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"))

View file

@ -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
(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))
(when source-index
(let ((source (nth source-index elem)))
(unless (string-empty-p source)
source)))))))))))
(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")))

View file

@ -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)

View file

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

View file

@ -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 = <api-key>
#+end_src
Then run =emacs= and make sure it starts.
* Metapac configuration

View file

@ -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)