dotfiles

A steaming hot pile of sh...ell scripts and configuration files.
git clone https://kaka.farm/~git/dotfiles
Log | Files | Refs

commit 5f47d98f590f5eb470d9e8789fb5be0d62474b49
parent 08233525da75d2204df6f14d2488b7ce62e1a7e5
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Sun, 16 Jun 2024 19:38:58 +0300

Update Emacs configuration.

- Add multi-vterm package and and key bindings.
- Some indentation stuff.

Diffstat:
Mconfig/emacs/init.el | 37++++++++++++++++++++++++++++++++-----
Mconfig/emacs/kakafarm-utils.el | 56++++++++++++++++++++++++++++++++++----------------------
2 files changed, 66 insertions(+), 27 deletions(-)

diff --git a/config/emacs/init.el b/config/emacs/init.el @@ -17,7 +17,15 @@ '(setq package-archives '()) (require 'use-package) +(mapcar (lambda (x) + (keymap-global-set x 'multi-vterm)) + (list "C-c m m" + "C-c m <RET>" + "C-c <RET> m" + "C-c <RET> <RET>")) + (use-package company + :defer t :init (add-hook 'after-init-hook 'global-company-mode)) @@ -49,8 +57,11 @@ :config (add-hook 'greader-mode-hook 'kakafarm/sentence-end-double-nilify-for-read-only-buffers) - :hook (Info-mode + :hook ( + Info-mode + Man-mode elfeed-show + elfeed-show-mode elpher eww-after-render fundamental-mode @@ -58,7 +69,8 @@ lisp-mode nov-mode text-mode - w3m-mode)) + w3m-mode + )) (use-package icomplete :config @@ -66,11 +78,13 @@ (icomplete-mode 1)) (use-package mastodon + :defer t :init (setq mastodon-active-user "kakafarm" mastodon-instance-url "https://emacs.ch/")) (use-package modus-themes + :defer t :init (setq modus-themes-mode-line '(borderless accented @@ -96,7 +110,7 @@ (set-language-environment "utf-8")) '(use-package nano-tts - :hook (eww-after-render nov-mode Info-mode)) + :hook (eww-after-render nov-mode Info-mode)) (use-package nov :mode ("\\.epub\\'" . nov-mode)) @@ -118,6 +132,12 @@ ;;(org-roam-db-autosync-mode) ) +;; XXX: Disabled. +'(use-package parinfer + :hook (emacs-lisp-mode + lisp-mode + scheme-mode)) + (use-package paredit :hook (emacs-lisp-mode lisp-mode @@ -156,6 +176,12 @@ ;; Don't want tabs in any of my source files. (setq-default indent-tabs-mode nil)) +(use-package window + :config + (advice-add 'recenter-top-bottom + :around + 'kakafarm/recenter-top-bottom)) + (defun kakafarm/load-emacs-from-scratch-stuff () "Emacs From Scratch https://systemcrafters.net/emacs-from-scratch/ @@ -174,8 +200,8 @@ (hl-line-mode 1) (blink-cursor-mode 1) - ;;; https://systemcrafters.net/emacs-from-scratch/the-best-default-settings/ - ;;; https://www.youtube.com/watch?v=51eSeqcaikM +;;; https://systemcrafters.net/emacs-from-scratch/the-best-default-settings/ +;;; https://www.youtube.com/watch?v=51eSeqcaikM ;;(recentf-mode 1) (setq history-length 25) (savehist-mode 1) @@ -220,3 +246,4 @@ 0)))))) (setq gc-cons-threshold (* 200 1024 1024)) +(put 'narrow-to-region 'disabled nil) diff --git a/config/emacs/kakafarm-utils.el b/config/emacs/kakafarm-utils.el @@ -1,3 +1,5 @@ +;;; -*- lexical-binding:t -*- + (defun kakafarm/call-process-with-string-as-input (program &optional input-string &rest args) (with-temp-buffer (let ((our-output-buffer (current-buffer))) @@ -109,23 +111,28 @@ https://www.tomsdiner.org/blog/post_0003_sourcehut_readme_org_export.html" (setq-local sentence-end-double-space nil))) -(defun kakafarm/elfeed-sort-feeds () - `(setq elfeed-feeds - ,(sort - (mapcar - (lambda (a-feed) - (let* ((feed-url (car a-feed)) - (tags (cdr a-feed)) - (tags-as-strings (mapcar #'symbol-name - tags)) - (sorted-tags (sort tags-as-strings - #'string-lessp)) - (tags-as-symbols (mapcar #'intern sorted-tags))) - (cons feed-url sorted-tags))) - elfeed-feeds) - (lambda (feed-a feed-b) - (string-lessp (car feed-a) - (car feed-b)))))) +(defun kakafarm/elfeed-sort-feed-tags (a-feed) + (cond + ((stringp a-feed) + a-feed) + (t + (let* ((feed-url (car a-feed)) + (tags (cdr a-feed)) + (tags-as-strings (mapcar #'symbol-name + tags)) + (sorted-tags (sort tags-as-strings + #'string-lessp)) + (tags-as-symbols (mapcar #'intern sorted-tags))) + (cons feed-url tags-as-symbols))))) + +(defun kakafarm/elfeed-compare-feeds-urls (feed-a feed-b) + (string-lessp (car feed-a) + (car feed-b))) + +(defun kakafarm/elfeed-sort-feeds (feeds) + (sort (mapcar #'kakafarm/elfeed-sort-feed-tags + feeds) + #'kakafarm/elfeed-compare-feeds-urls)) (defun kakafarm/org-roam-keyword-is-filetags-p (keyword-node) (equal (org-element-property :key @@ -142,11 +149,11 @@ https://www.tomsdiner.org/blog/post_0003_sourcehut_readme_org_export.html" (with-temp-buffer (insert-file-contents org-filename) (org-element-map (org-element-parse-buffer) 'keyword - (lambda (keyword) - (and (kakafarm/org-roam-keyword-is-filetags-p keyword) - (kakafarm/org-roam-filetags-keyword-is-publishable-p keyword))) - nil - t))) + (lambda (keyword) + (and (kakafarm/org-roam-keyword-is-filetags-p keyword) + (kakafarm/org-roam-filetags-keyword-is-publishable-p keyword))) + nil + t))) (defun kakafarm/org-roam-sitemap (title list-of-org-links) (message (format "kakafarm/org-roam-sitemap title: %S; list-of-links: %S\n" @@ -201,3 +208,8 @@ https://www.tomsdiner.org/blog/post_0003_sourcehut_readme_org_export.html" (message (format "kakafarm/org-roam-custom-link-builder: %S" node)) (concat (file-name-base node-file) ".html"))) + +(defun kakafarm/recenter-top-bottom (original-function &rest arguments) + (if (null (car arguments)) + (apply original-function '(4)) + (apply original-function arguments)))