Compare commits

...

2 commits

Author SHA1 Message Date
6b058cc2cf emacs: switch to org from the repo, fix org-cycle
Some checks failed
Update Site / trigger_update (push) Has been cancelled
2025-11-27 07:41:58 +03:00
d8a14dc486 arch: update latex 2025-11-27 07:41:45 +03:00
7 changed files with 204 additions and 12 deletions

View file

@ -3,7 +3,7 @@ enabled_backends = ["arch"]
hostname_groups_enabled = true
[hostname_groups]
violet = ["system","office","nvidia","music","mail","latex","emacs","dev","desktop-rofi","desktop-polybar","desktop-misc","desktop","console","browsers"]
violet = ["printer","system","office","nvidia","music","mail","latex","emacs","dev","desktop-rofi","desktop-polybar","desktop-misc","desktop","console","browsers"]
weiss = ["system","office","music","mail","latex","emacs","dev","desktop-rofi","desktop-polybar","desktop-misc","desktop","console","browsers"]
archlinux = ["system","office","music","mail","latex","emacs","dev","desktop-rofi","desktop-polybar","desktop-misc","desktop","console","browsers"]

View file

@ -18,6 +18,7 @@ arch = [
"texlive-games",
"texlive-formatsextra",
"texlive-fontutils",
"texlive-langcyrillic",
"texlive-binextra",
"texlive-bibtexextra",
"texlive-basic",]

View file

@ -5,4 +5,4 @@ Description=Music Player Daemon
ExecStart=/usr/bin/mpd --no-daemon
[Install]
WantedBy=graphical-session.target
WantedBy=wm-session.target

View file

@ -2,7 +2,7 @@
(setq org-directory (expand-file-name "~/30-39 Life/32 org-mode"))
(use-package org
:straight (:type built-in)
:straight t
:defer t
:init
(unless (file-exists-p org-directory)
@ -53,8 +53,7 @@
(use-package org-contrib
:straight (org-contrib
:type git
:repo "https://git.sr.ht/~bzg/org-contrib"
:build t)
:repo "https://git.sr.ht/~bzg/org-contrib")
:after (org)
:config
(require 'ox-extra)
@ -193,6 +192,92 @@ With ARG, repeats or can move backward if negative."
(concat org-directory "/"
(completing-read "Org file: " files)))))
(defvar-local my/org-fold-cycle-last-pos nil
"Last position where `my/org-fold-cycle' was called.")
(defvar-local my/org-fold-cycle-status nil
"Current folding status for `my/org-fold-cycle'.
Can be 'folded, 'children, or 'subtree.")
(defun my/org-fold-cycle ()
"Cycle folding state of current heading.
The cycling works as follows:
- If heading is FOLDED: show children only
- If heading shows CHILDREN and this was the last command at same position:
* If heading has sub-headings: show entire subtree
* If heading has no sub-headings: fold the heading
- Otherwise: fold the heading
The complete cycle is:
- With children: FOLDED CHILDREN SUBTREE FOLDED
- Without children: FOLDED CHILDREN FOLDED
If not at a heading, delegates to the normal `org-cycle' function."
(interactive)
;; If not at a heading and can't move to one, delegate to org-cycle
(unless (org-at-heading-p)
(org-cycle)
(cl-return-from my/org-fold-cycle))
(let* ((current-pos (point))
(eoh (save-excursion (outline-end-of-heading) (point)))
(eos (save-excursion
(org-end-of-subtree t t)
(if (eobp) (point) (1- (point)))))
;; Check if content after heading is folded
(folded-p (org-fold-folded-p eoh 'headline))
;; Check if we're continuing from the same position
(same-pos (equal my/org-fold-cycle-last-pos current-pos))
(continued (and (or (eq last-command 'my/org-fold-cycle)
(eq last-command 'org-cycle))
same-pos))
;; Check if heading has children (sub-headings)
(has-children (save-excursion
(org-back-to-heading t)
(let ((level (org-current-level)))
(outline-next-heading)
(and (not (eobp))
(> (org-current-level) level))))))
(cond
;; State 1: Heading is folded → show children
(folded-p
(org-fold-show-entry)
(org-fold-show-children)
(org-unlogged-message "CHILDREN")
(setq my/org-fold-cycle-status 'children))
;; State 2: Was showing children, same position → show entire subtree (if has children)
((and continued (eq my/org-fold-cycle-status 'children))
(if has-children
(progn
(org-fold-show-subtree)
(org-unlogged-message "SUBTREE")
(setq my/org-fold-cycle-status 'subtree))
;; No children, skip SUBTREE and fold directly
(org-fold-hide-subtree)
(org-unlogged-message "FOLDED")
(setq my/org-fold-cycle-status 'folded)))
;; State 3: Otherwise → fold the heading
(t
(org-fold-hide-subtree)
(org-unlogged-message "FOLDED")
(setq my/org-fold-cycle-status 'folded)))
;; Remember position for next invocation
(setq my/org-fold-cycle-last-pos current-pos)))
(defun my/org-fold-cycle-around (fun &rest args)
(if (org-at-heading-p)
(my/org-fold-cycle)
(apply fun args)))
(with-eval-after-load 'org-cycle
(advice-add #'org-cycle :around #'my/org-fold-cycle-around))
(defun my/enable-org-latex ()
(interactive)
(customize-set-variable 'org-highlight-latex-and-related '(native))

View file

@ -166,6 +166,7 @@ Below is the table enabling different groups on different hostnames:
| nvidia | | | + |
| office | + | + | + |
| system | + | + | + |
| printer | | | + |
And the code to format it as TOML:
#+NAME: metapac-groups-format
@ -244,12 +245,22 @@ Various drivers, I'm not sure which I actually need, so...
| xf86-video-amdgpu |
| xf86-video-ati |
NVIDIA drivers for violet
NVIDIA drivers & AI stuff for violet
| Category | Arch dependency |
|----------+-----------------|
| nvidia | cuda |
| nvidia | nvidia-utils |
| nvidia | nvidia |
| nvidia | ollama-cuda |
Printer packages.
| Category | Arch dependency |
|----------+-----------------|
| printer | cups |
| printer | usbutils |
| printer | brlaser |
| printer | naps2-bin |
| printer | brscan4 |
#+NAME: packages
#+begin_src emacs-lisp :tangle no :var category=""
@ -260,6 +271,10 @@ NVIDIA drivers for violet
<<packages("nvidia")>>
#+end_src
#+begin_src scheme :tangle .config/metapac/groups/printer.toml :noweb yes
<<packages("printer")>>
#+end_src
#+begin_src scheme :tangle .config/metapac/groups/system.toml :noweb yes
<<packages()>>
#+end_src

View file

@ -4318,7 +4318,6 @@ c.tabs.favicons.scale = 1
#+end_src
* Various software
This section generates manifests for various desktop software that I'm using.
** Browsers
| Category | Arch dependency |
|----------+------------------------|
@ -4345,6 +4344,7 @@ This section generates manifests for various desktop software that I'm using.
| latex | texlive-basic | |
| latex | texlive-bibtexextra | |
| latex | texlive-binextra | |
| latex | texlive-langcyrillic | |
| latex | texlive-fontsextra | t |
| latex | texlive-fontutils | |
| latex | texlive-formatsextra | |
@ -4531,7 +4531,7 @@ Description=Music Player Daemon
ExecStart=/usr/bin/mpd --no-daemon
[Install]
WantedBy=graphical-session.target
WantedBy=wm-session.target
#+end_src
#+begin_src conf :tangle .config/systemd/user/deterred-mpd.service

View file

@ -4993,13 +4993,15 @@ References:
- [[https://orgmode.org/manual/][Manual]]
** Installation & basic settings
Use the built-in org mode (=:type built-in=).
Somehow the built-in =org-mode= had some issues with native-comp on my setup, so I pull the latest version from git for now.
I tried to pin the package with straight, but somehow this doesn't seem to work...
#+begin_src emacs-lisp :noweb yes
(setq org-directory (expand-file-name "~/30-39 Life/32 org-mode"))
(use-package org
:straight (:type built-in)
:straight t
:defer t
:init
(unless (file-exists-p org-directory)
@ -5069,8 +5071,7 @@ This used to have =org-contacts= and =ol-notmuch= at some point, but they have s
(use-package org-contrib
:straight (org-contrib
:type git
:repo "https://git.sr.ht/~bzg/org-contrib"
:build t)
:repo "https://git.sr.ht/~bzg/org-contrib")
:after (org)
:config
(require 'ox-extra)
@ -5239,6 +5240,96 @@ A function to open a file from =org-directory=, excluding a few directories like
(concat org-directory "/"
(completing-read "Org file: " files)))))
#+end_src
*** Fix org-cycle
I don't know what's going on with =org-cycle=...
#+begin_src emacs-lisp
(defvar-local my/org-fold-cycle-last-pos nil
"Last position where `my/org-fold-cycle' was called.")
(defvar-local my/org-fold-cycle-status nil
"Current folding status for `my/org-fold-cycle'.
Can be 'folded, 'children, or 'subtree.")
(defun my/org-fold-cycle ()
"Cycle folding state of current heading.
The cycling works as follows:
- If heading is FOLDED: show children only
- If heading shows CHILDREN and this was the last command at same position:
* If heading has sub-headings: show entire subtree
* If heading has no sub-headings: fold the heading
- Otherwise: fold the heading
The complete cycle is:
- With children: FOLDED → CHILDREN → SUBTREE → FOLDED
- Without children: FOLDED → CHILDREN → FOLDED
If not at a heading, delegates to the normal `org-cycle' function."
(interactive)
;; If not at a heading and can't move to one, delegate to org-cycle
(unless (org-at-heading-p)
(org-cycle)
(cl-return-from my/org-fold-cycle))
(let* ((current-pos (point))
(eoh (save-excursion (outline-end-of-heading) (point)))
(eos (save-excursion
(org-end-of-subtree t t)
(if (eobp) (point) (1- (point)))))
;; Check if content after heading is folded
(folded-p (org-fold-folded-p eoh 'headline))
;; Check if we're continuing from the same position
(same-pos (equal my/org-fold-cycle-last-pos current-pos))
(continued (and (or (eq last-command 'my/org-fold-cycle)
(eq last-command 'org-cycle))
same-pos))
;; Check if heading has children (sub-headings)
(has-children (save-excursion
(org-back-to-heading t)
(let ((level (org-current-level)))
(outline-next-heading)
(and (not (eobp))
(> (org-current-level) level))))))
(cond
;; State 1: Heading is folded → show children
(folded-p
(org-fold-show-entry)
(org-fold-show-children)
(org-unlogged-message "CHILDREN")
(setq my/org-fold-cycle-status 'children))
;; State 2: Was showing children, same position → show entire subtree (if has children)
((and continued (eq my/org-fold-cycle-status 'children))
(if has-children
(progn
(org-fold-show-subtree)
(org-unlogged-message "SUBTREE")
(setq my/org-fold-cycle-status 'subtree))
;; No children, skip SUBTREE and fold directly
(org-fold-hide-subtree)
(org-unlogged-message "FOLDED")
(setq my/org-fold-cycle-status 'folded)))
;; State 3: Otherwise → fold the heading
(t
(org-fold-hide-subtree)
(org-unlogged-message "FOLDED")
(setq my/org-fold-cycle-status 'folded)))
;; Remember position for next invocation
(setq my/org-fold-cycle-last-pos current-pos)))
(defun my/org-fold-cycle-around (fun &rest args)
(if (org-at-heading-p)
(my/org-fold-cycle)
(apply fun args)))
(with-eval-after-load 'org-cycle
(advice-add #'org-cycle :around #'my/org-fold-cycle-around))
#+end_src
** UI
*** LaTeX fragments