summaryrefslogtreecommitdiff
path: root/config.org
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-09-09 00:52:06 +0200
committercashmere <cashmere@autistici.org>2026-09-09 00:52:06 +0200
commit68902f04e91df6bee937007bf75e439c929e6737 (patch)
tree5e56892a00a884981437ea28bdc933de333a863d /config.org
parent1083569c5dc17d49fff09974e8bf6fe243a7cbbb (diff)
downloademacs-68902f04e91df6bee937007bf75e439c929e6737.tar.gz
relic: 2026-09-09T00:52:25+02:00
Diffstat (limited to 'config.org')
-rw-r--r--config.org331
1 files changed, 240 insertions, 91 deletions
diff --git a/config.org b/config.org
index db84ab2..4169cfe 100644
--- a/config.org
+++ b/config.org
@@ -37,7 +37,8 @@
(setq my/local-packages
'((kitty-graphics . "~/code/kitty-graphics")))
-(setq cashmere/frame-alpha-background 100
+(setq cashmere/frame-alpha 100
+ cashmere/frame-alpha-background nil
cashmere/font-family "SFMono Nerd Font"
cashmere/font-height 180
cashmere/theme 'tinty)
@@ -48,8 +49,10 @@
(defvar my/local-packages nil
"Alist of (PACKAGE . DIRECTORY) loaded from a local checkout.
Set per-host in the gitignored `local.el'.")
+ (defvar cashmere/frame-alpha nil
+ "Per-host opacity for the entire frame, or nil to keep foreground elements opaque.")
(defvar cashmere/frame-alpha-background nil
- "Per-host frame opacity, or nil for the Emacs default.")
+ "Per-host background-only opacity, or nil for the Emacs default.")
(defvar cashmere/font-family "Maple Mono NF"
"Per-host default monospace font family.")
(defvar cashmere/font-height 180
@@ -58,15 +61,20 @@ Set per-host in the gitignored `local.el'.")
"Per-host theme to load, or nil for no theme.")
(load (locate-user-emacs-file "local.el") 'noerror 'nomessage))
-;; Apply appearance settings at runtime only. Keeping these outside
-;; `eval-and-compile' avoids loading themes or mutating the initial daemon
-;; frame while native compilation is inspecting the configuration.
-(when cashmere/frame-alpha-background
- (add-to-list 'default-frame-alist
- `(alpha-background . ,cashmere/frame-alpha-background))
+;; Apply appearance settings at runtime only. Keeping these outside `eval-and-compile' avoids loading themes or mutating the initial daemon frame while native compilation is inspecting the configuration. Whole-frame opacity takes precedence because combining both alpha modes would dim the frame twice.
+(cond
+ (cashmere/frame-alpha
+ (add-to-list 'default-frame-alist '(alpha-background . 100))
+ (add-to-list 'default-frame-alist `(alpha . ,cashmere/frame-alpha))
(when (display-graphic-p)
- (set-frame-parameter nil 'alpha-background
- cashmere/frame-alpha-background)))
+ (set-frame-parameter nil 'alpha-background 100)
+ (set-frame-parameter nil 'alpha cashmere/frame-alpha)))
+ (cashmere/frame-alpha-background
+ (add-to-list 'default-frame-alist '(alpha . 100))
+ (add-to-list 'default-frame-alist `(alpha-background . ,cashmere/frame-alpha-background))
+ (when (display-graphic-p)
+ (set-frame-parameter nil 'alpha 100)
+ (set-frame-parameter nil 'alpha-background cashmere/frame-alpha-background))))
(when cashmere/theme
(add-to-list 'custom-theme-load-path
@@ -2548,13 +2556,13 @@ Auto switch silos (different workspaces/folders) based on preconfigured director
* company-mode
-#+begin_src emacs-lisp :tangle yes
+#+begin_src emacs-lisp
(use-package company
:ensure t
:demand t
:hook (after-init . global-company-mode)
:custom
- (company-idle-delay 0.1)
+ (company-idle-delay 0.25)
(company-minimum-prefix-length 2)
(company-require-match nil)
(company-insertion-on-trigger nil)
@@ -2565,32 +2573,67 @@ Auto switch silos (different workspaces/folders) based on preconfigured director
(company-frontends '(my/company-popup-frontend company-echo-metadata-frontend))
:config
(require 'company-childframe)
- (defun my/company-popup-frontend (command)
- "Use an aligned child frame in graphical Emacs and an overlay in terminals."
- (cond
- ((eq command 'hide)
- (company-childframe-hide)
- (company-pseudo-tooltip-hide))
- ((display-graphic-p)
- (company-childframe-frontend command))
- (t
- (company-pseudo-tooltip-frontend command))))
- (setq company-selection-default 0)
- (defun my/company-abort-and-normal-state ()
- "Close completion and leave Evil insert state."
- (interactive)
- (company-abort)
- (when (bound-and-true-p evil-local-mode)
- (evil-normal-state)))
- (defun my/company-navigation-keys (&rest _)
- "Keep completion navigation consistent after Evil Collection loads."
- (dolist (key '("TAB" "<tab>" "C-n" "C-j"))
- (keymap-set company-active-map key #'company-select-next))
- (dolist (key '("<backtab>" "S-TAB" "C-p" "C-k"))
- (keymap-set company-active-map key #'company-select-previous))
- (keymap-set company-active-map "RET" #'company-complete-selection)
- (keymap-set company-active-map "<return>" #'company-complete-selection)
- (keymap-set company-active-map "<escape>" #'my/company-abort-and-normal-state))
+ (setq company-selection-default 0))
+#+end_src
+
+** company-popup-frontend
+
+#+begin_src emacs-lisp
+(defun my/company-popup-frontend (command)
+ "Use an aligned child frame in graphical Emacs and an overlay in terminals."
+ (cond
+ ((eq command 'hide)
+ (company-childframe-hide)
+ (company-pseudo-tooltip-hide))
+ ((display-graphic-p)
+ (company-childframe-frontend command))
+ (t
+ (company-pseudo-tooltip-frontend command))))
+#+end_src
+
+** company-abort-and-normal-state
+
+#+begin_src emacs-lisp
+(defun my/company-abort-and-normal-state ()
+ "Close completion and leave Evil insert state."
+ (interactive)
+ (company-abort)
+ (when (bound-and-true-p evil-local-mode)
+ (evil-normal-state)))
+#+end_src
+
+** company-tab
+
+#+begin_src emacs-lisp
+(defun my/company-tab ()
+ "Indent programming buffers or advance an active snippet; otherwise select a candidate."
+ (interactive)
+ (if (derived-mode-p 'prog-mode)
+ (progn
+ (company-abort)
+ (if (and (bound-and-true-p yas-minor-mode)
+ (yas-active-snippets))
+ (yas-next-field)
+ (indent-for-tab-command)))
+ (company-select-next)))
+#+end_src
+
+** company-navigation-keys
+
+#+begin_src emacs-lisp
+(defun my/company-navigation-keys (&rest _)
+ "Keep completion navigation consistent after Evil Collection loads."
+ (dolist (key '("TAB" "<tab>"))
+ (keymap-set company-active-map key #'my/company-tab))
+ (dolist (key '("C-n" "C-j"))
+ (keymap-set company-active-map key #'company-select-next))
+ (dolist (key '("<backtab>" "S-TAB" "C-p" "C-k"))
+ (keymap-set company-active-map key #'company-select-previous))
+ (keymap-set company-active-map "RET" #'company-complete-selection)
+ (keymap-set company-active-map "<return>" #'company-complete-selection)
+ (keymap-set company-active-map "<escape>" #'my/company-abort-and-normal-state))
+
+(with-eval-after-load 'company
(my/company-navigation-keys)
(add-hook 'evil-collection-setup-hook #'my/company-navigation-keys))
#+end_src
@@ -2628,24 +2671,6 @@ Auto switch silos (different workspaces/folders) based on preconfigured director
(add-hook 'completion-at-point-functions #'cape-file))
#+end_src
-* COMMENT embark
-
-#+begin_src emacs-lisp
-(use-package embark
- :ensure (:wait t)
- :defer t
- :bind
- (("C-." . embark-act)
- ("M-." . embark-dwim)
- ("C-h B" . embark-bindings)
- :map minibuffer-local-map
- ("C-c C-a" . embark-act-all)
- ("C-c C-e" . embark-export)
- ("C-c C-o" . embark-collect))
- :init
- (setq prefix-help-command #'embark-prefix-help-command))
-#+end_src
-
* helm-mode
#+begin_src emacs-lisp
@@ -2761,6 +2786,16 @@ Auto switch silos (different workspaces/folders) based on preconfigured director
#+end_src
* programming
+** programming-indent-setup
+
+#+begin_src emacs-lisp
+(defun my/programming-indent-setup ()
+ "Use TAB to indent programming buffers without starting completion."
+ (setq-local tab-always-indent t))
+
+(add-hook 'prog-mode-hook #'my/programming-indent-setup)
+#+end_src
+
** typst-mode
#+begin_src emacs-lisp
@@ -2786,6 +2821,15 @@ Auto switch silos (different workspaces/folders) based on preconfigured director
(yas-reload-all))
#+end_src
+*** yas-tab-filter
+
+#+begin_src emacs-lisp
+(defun my/yas-tab-filter (command)
+ "Offer Yasnippet expansion through TAB outside programming buffers."
+ (unless (derived-mode-p 'prog-mode)
+ (yas-maybe-expand-abbrev-key-filter command)))
+#+end_src
+
** nix-ts-mode
#+begin_src emacs-lisp
@@ -2839,6 +2883,27 @@ Built-in tree-sitter mode (Emacs 29+). The =c= grammar ships via =treesit-gramma
(c-ts-mode-indent-style 'k&r))
#+end_src
+** c3-ts-mode
+
+#+begin_src emacs-lisp
+(use-package c3-ts-mode
+ :ensure (:host github :repo "c3lang/c3-ts-mode"
+ :ref "d6ad0e39351d4a5430e731d05474a064dcdb2bc6"
+ :files ("c3-ts-mode.el"))
+ :mode "\\.c3[it]?\\'"
+ :init
+ (with-eval-after-load 'treesit
+ (setf (alist-get 'c3 treesit-language-source-alist)
+ '("https://github.com/c3lang/tree-sitter-c3"
+ :commit "56d73880751a3f442296d7042e7f0a3d21967238")))
+ :custom
+ (c3-ts-mode-indent-offset 2)
+ (c3-ts-mode-highlight-variable t)
+ (c3-ts-mode-highlight-property t)
+ (c3-ts-mode-highlight-assignment t)
+ (c3-ts-mode-highlight-punctuation t))
+#+end_src
+
** rust-ts-mode
#+begin_src emacs-lisp
@@ -3036,7 +3101,8 @@ BODY is the xonsh script. PARAMS may include :dir and :cmdline."
(use-package diff-hl
:ensure t
:hook (((prog-mode text-mode conf-mode) . diff-hl-mode)
- (magit-post-refresh . diff-hl-magit-post-refresh))
+ (magit-post-refresh . diff-hl-magit-post-refresh)
+ (fossil-ui-post-refresh . fossil-ui-diff-hl-refresh))
:custom
(diff-hl-margin-symbols-alist
'((insert . "┃") (delete . "▁") (change . "┃")
@@ -3087,35 +3153,6 @@ BODY is the xonsh script. PARAMS may include :dir and :cmdline."
(lambda (window buffer bury-or-kill)
(string-match-p "\\*magit" (buffer-name buffer))))
-(defcustom my/auto-git-add-exclude-regexps
- '("/\\.git/" "/node_modules/" "/\\.direnv/" "/straight/" "/elpaca/"
- "\\.gpg\\'" "/\\.cache/" "/__pycache__/")
- "Paths matching these regexps are skipped by `my/auto-git-add-new-file'."
- :type '(repeat regexp)
- :group 'my)
-
-(defun my/auto-git-add-new-file ()
- "Stage newly created file with intent-to-add so magit shows diffs.
-Runs on `after-save-hook'. Only acts when the saved file is inside a
-git project and currently untracked. Uses `git add -N' (intent-to-add)
-so the working-tree diff stays visible until the user explicitly stages."
- (let ((file buffer-file-name))
- (when (and file
- (file-exists-p file)
- (not (seq-some (lambda (re) (string-match-p re file))
- my/auto-git-add-exclude-regexps))
- (locate-dominating-file file ".git"))
- (let ((default-directory (file-name-directory file)))
- (when (and (zerop (call-process "git" nil nil nil "rev-parse" "--is-inside-work-tree"))
- ;; ls-files --error-unmatch exits non-zero if untracked
- (not (zerop (call-process "git" nil nil nil
- "ls-files" "--error-unmatch" file))))
- (call-process "git" nil nil nil "add" "-N" file)
- (when (fboundp 'magit-refresh)
- (magit-refresh))
- (message "auto-staged (intent-to-add): %s" (file-name-nondirectory file)))))))
-
-(add-hook 'after-save-hook #'my/auto-git-add-new-file)
(defun my/magit-uncommit ()
"Undo the last commit, leaving its changes in the working tree, unstaged."
@@ -3647,13 +3684,12 @@ moved to local.el
#+begin_src emacs-lisp
(use-package textui
- :ensure (:host github :repo "yibie/textui" :files ("*.el")))
+ :ensure (:host github :repo "yibie/textui" :ref "v0.8.0" :files ("*.el")))
+#+end_src
-(use-package fossil-ui
- :ensure nil
- :after textui
- :commands (fossil-ui fossil-ui-status))
+* bbs-ui
+#+begin_src emacs-lisp
(use-package bbs-ui
:ensure nil
:after textui
@@ -3663,7 +3699,40 @@ moved to local.el
(expand-file-name "bbs-sandbox.fossil" "/home/cashmere/bbs/"))
(bbs-ui-web-base-url "https://bbs.copland.systems")
(bbs-ui-pull-on-open nil))
+#+end_src
+
+* fossil-ui
+#+begin_src emacs-lisp
+(use-package fossil-ui
+ :ensure nil
+ :demand t
+ :after textui
+ :commands (fossil-ui fossil-ui-status)
+ :hook (fossil-ui-diff-mode . visual-line-mode)
+ :custom
+ (fossil-ui-title-alignment 'center)
+ (fossil-ui-text-wrap 'greedy)
+ (fossil-ui-preview-lines 20)
+ (fossil-ui-diff-renderer 'auto)
+ (fossil-ui-stage-directory (expand-file-name "fossil-stage/" user-emacs-directory))
+ (fossil-ui-max-stage-bytes (* 5 1024 1024))
+ (fossil-ui-keyed-timeline t)
+ (fossil-ui-full-frame t)
+ (fossil-ui-confirm-revert t)
+ (fossil-ui-compact-layout t)
+ :config
+ (with-eval-after-load 'zoom
+ (dolist (mode '(fossil-ui-mode fossil-ui-diff-mode))
+ (add-to-list 'zoom-ignored-major-modes mode)))
+ (with-eval-after-load 'golden-ratio
+ (dolist (mode '(fossil-ui-mode fossil-ui-diff-mode))
+ (add-to-list 'golden-ratio-exclude-modes mode))))
+#+end_src
+
+* yggdrasil-ui
+
+#+begin_src emacs-lisp
(use-package yggdrasil-ui
:ensure nil
:after textui
@@ -3791,7 +3860,34 @@ This function records the time when `window-setup-hook' runs."
projectile-require-project-root nil
projectile-globally-ignored-buffers '("\\*magit.*"))
(add-hook 'after-save-hook #'projectile-cache-current-file))
+#+end_src
+
+** projectile-fossil-command
+#+begin_src emacs-lisp
+(defun my/projectile-fossil-command (original vcs &optional directory)
+ "Return a Fossil listing relative to DIRECTORY, delegating other VCS to ORIGINAL."
+ (if (not (eq vcs 'fossil))
+ (funcall original vcs directory)
+ (let* ((directory (file-name-as-directory
+ (expand-file-name (or directory default-directory))))
+ (checkout (or (locate-dominating-file directory ".fslckout")
+ (locate-dominating-file directory "_FOSSIL_")
+ (user-error "No Fossil checkout for %s" directory)))
+ (prefix (if (file-equal-p directory checkout)
+ ""
+ (file-relative-name directory checkout))))
+ (format "fossil ls . | cut -b %d- | tr '\\n' '\\0'"
+ (1+ (string-bytes prefix))))))
+
+(with-eval-after-load 'projectile
+ (advice-add 'projectile-get-ext-command :around
+ #'my/projectile-fossil-command))
+#+end_src
+
+** projectile-dashboard-fullscreen
+
+#+begin_src emacs-lisp
(defun my/projectile-dashboard-fullscreen ()
"Show the Projectile dashboard in the full frame."
(interactive)
@@ -4573,6 +4669,14 @@ place. `C-c C-c' commits, `C-c C-k' aborts."
(kbd "P") #'my/evil-move-visual-lines-up)
#+end_src
+** yasnippet-mode
+
+#+begin_src emacs-lisp
+(with-eval-after-load 'yasnippet
+ (define-key yas-minor-mode-map (kbd "TAB")
+ '(menu-item "" yas-expand :filter my/yas-tab-filter)))
+#+end_src
+
** compilation-mode
#+begin_src emacs-lisp
@@ -4749,6 +4853,51 @@ place. `C-c C-c' commits, `C-c C-k' aborts."
(kbd "F") #'link-hint-copy-link))
#+end_src
+** fossil-ui-mode
+
+#+begin_src emacs-lisp
+(with-eval-after-load 'fossil-ui
+ (evil-define-key '(normal motion visual) fossil-ui-mode-map
+ (kbd "SPC") my/leader-map
+ (kbd "V") #'evil-visual-line
+ (kbd "s") #'fossil-ui-stage
+ (kbd "u") #'fossil-ui-unstage
+ (kbd "r") #'fossil-ui-refresh
+ (kbd "x") #'fossil-ui-discard
+ (kbd "d") #'fossil-ui-delete
+ (kbd "G") #'evil-goto-line
+ (kbd "TAB") #'fossil-ui-diff
+ (kbd "<tab>") #'fossil-ui-diff
+ (kbd "c") nil
+ (kbd "c c") #'fossil-ui-commit
+ (kbd "S") #'fossil-ui-sync
+ (kbd "F") #'fossil-ui-update
+ (kbd "RET") #'fossil-ui-visit-file
+ (kbd "<return>") #'fossil-ui-visit-file
+ (kbd "D") #'fossil-ui-staged-diff
+ (kbd "q") #'fossil-ui-quit
+ (kbd "?") #'fossil-ui-help)
+ (evil-define-key '(normal motion visual) fossil-ui-diff-mode-map
+ (kbd "SPC") my/leader-map
+ (kbd "V") #'evil-visual-line
+ (kbd "G") #'evil-goto-line
+ (kbd "s") #'fossil-ui-stage
+ (kbd "u") #'fossil-ui-unstage
+ (kbd "x") #'fossil-ui-discard
+ (kbd "r") #'fossil-ui-diff-refresh
+ (kbd "D") #'fossil-ui-diff-toggle
+ (kbd "q") #'fossil-ui-quit)
+ (evil-define-key 'visual fossil-ui-mode-map
+ (kbd "j") #'evil-next-line
+ (kbd "k") #'evil-previous-line)
+ (evil-define-key 'visual fossil-ui-diff-mode-map
+ (kbd "j") #'evil-next-line
+ (kbd "k") #'evil-previous-line)
+ (evil-define-key '(normal insert visual motion) fossil-ui-commit-mode-map
+ (kbd "C-c C-c") #'fossil-ui-commit-submit
+ (kbd "C-c C-k") #'fossil-ui-commit-cancel))
+#+end_src
+
** ghostel-mode
#+begin_src emacs-lisp