dotfiles

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

commit 385e75af4d1f5b81024edb61466bc93abd06a5de
parent 61d37079d75d20f8002a76a234737ce5fc7ceb83
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Fri, 12 Jul 2024 12:04:13 +0300

New stuff in init script and kakafarm utility functions.

Diffstat:
Mconfig/emacs/init.el | 129+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------
Mconfig/emacs/kakafarm-utils.el | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 190 insertions(+), 33 deletions(-)

diff --git a/config/emacs/init.el b/config/emacs/init.el @@ -14,20 +14,25 @@ (load (locate-user-emacs-file "kakafarm-utils.el")) (load (locate-user-emacs-file "local-stuff.el")) -'(setq package-archives '()) +(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>")) +(dolist (x '("C-c m m" + "C-c m <RET>" + "C-c <RET> m" + "C-c <RET> <RET>")) + (keymap-global-set x 'multi-vterm)) -(use-package company - :defer t - :init - (add-hook 'after-init-hook 'global-company-mode)) +'(use-package company + :defer t + :init + (add-hook 'after-init-hook 'global-company-mode)) + +(use-package corfu + :config + (global-corfu-mode) + :custom + (corfu-auto t)) (use-package cus-edit :config @@ -36,12 +41,61 @@ (load custom-file 'noerror 'nomessage)) (use-package dictionary - :config - (setq dictionary-server "localhost")) + :custom + (dictionary-server "localhost")) (use-package elfeed + :defer t :config - (load (locate-user-emacs-file "elfeed-feeds.el"))) + (load (locate-user-emacs-file "elfeed-feeds.el")) + :custom + (elfeed-curl-max-connections 10) + (elfeed-search-filter "@2-months +unread")) + +(use-package emacs + :ensure nil + :defer + :bind + ;;((";" . #'kakafarm/easy-underscore)) + ) + +(use-package fontset + :config + (set-fontset-font t 'hebrew "Noto Sans Hebrew")) + +(use-package orderless + :custom + (completion-styles + '(orderless + basic)) + (completion-category-overrides + '((file (styles + basic + partial-completion))))) + +(use-package erc + :custom + (erc-server "irc.libera.chat") + (erc-nick "kakafarm") + (erc-track-shorten-start 8) + (erc-kill-buffer-on-part t) + (erc-auto-query 'bury) + (erc-autojoin-channels-alist '((libera-kakafarm "#systemcrafters"))) + :bind + (("C-c i r c" . (lambda () + (interactive) + (erc-tls :id 'libera-kakafarm)))) + ;; :config + ;; (erc-tls :id 'libera-kakafarm) + ) + +(use-package ffap + :bind + (("C-c f a p" . ffap-menu))) + +'(use-package mutli-vterm + :bind + (("C-q" . vterm-send-next-key))) (use-package geiser :after (scheme-mode) @@ -58,6 +112,7 @@ (add-hook 'greader-mode-hook 'kakafarm/sentence-end-double-nilify-for-read-only-buffers) :hook ( + help-mode Info-mode Man-mode elfeed-show @@ -77,6 +132,10 @@ ;; Display completions continuously in minibuffer. (icomplete-mode 1)) +(use-package magit-todos + :after magit + :config (magit-todos-mode 1)) + (use-package mastodon :defer t :init @@ -102,13 +161,18 @@ modus-themes-scale-headings t modus-themes-org-blocks 'tinted-background) (load-theme 'modus-vivendi) - '(load-theme 'wheatgrass)) + ;;(load-theme 'wheatgrass) + ) (use-package mule :config ;;; https://emacs.stackexchange.com/questions/34322/set-default-coding-system-utf-8 (set-language-environment "utf-8")) +(use-package info + :custom + (Info-additional-directory-list '("~/infopath/"))) + '(use-package nano-tts :hook (eww-after-render nov-mode Info-mode)) @@ -171,10 +235,20 @@ ) (use-package simple + :defer + :init + (advice-add 'kill-ring-save + :before + 'kakafarm/pulse-current-region) :config (column-number-mode) ;; Don't want tabs in any of my source files. - (setq-default indent-tabs-mode nil)) + (setq-default indent-tabs-mode + nil) + (advice-add 'scratch-buffer + :after + (lambda () "Switch to text-mode." + (text-mode)))) (use-package window :config @@ -182,17 +256,18 @@ :around 'kakafarm/recenter-top-bottom)) -(defun kakafarm/load-emacs-from-scratch-stuff () - "Emacs From Scratch - https://systemcrafters.net/emacs-from-scratch/ - https://www.youtube.com/playlist?list=PLEoMzSkcN8oPH1au7H6B7bBJ4ZO7BXjSZ" +(progn +;;; Emacs From Scratch +;;; https://systemcrafters.net/emacs-from-scratch/ +;;; https://www.youtube.com/playlist?list=PLEoMzSkcN8oPH1au7H6B7bBJ4ZO7BXjSZ (setq visible-cursor t visible-bell t) - ;; The Basics of Emacs Configuration - ;; https://systemcrafters.net/emacs-from-scratch/basics-of-emacs-configuration/ - ;; https://www.youtube.com/watch?v=OaF-N-FuGtc +;;; The Basics of Emacs Configuration +;;; https://systemcrafters.net/emacs-from-scratch/basics-of-emacs-configuration/ +;;; https://www.youtube.com/watch?v=OaF-N-FuGtc + (tool-bar-mode -1) (scroll-bar-mode -1) (menu-bar-mode -1) @@ -206,14 +281,9 @@ (setq history-length 25) (savehist-mode 1) (save-place-mode 1)) -(kakafarm/load-emacs-from-scratch-stuff) - - -(set-fontset-font t 'hebrew "Noto Sans Hebrew") - (progn - ;; Load org-roam stuff. +;;; Load org-roam stuff. (setq kakafarm/org-roam-my-publish-time 0) @@ -247,3 +317,4 @@ (setq gc-cons-threshold (* 200 1024 1024)) (put 'narrow-to-region 'disabled nil) +(put 'upcase-region 'disabled nil) diff --git a/config/emacs/kakafarm-utils.el b/config/emacs/kakafarm-utils.el @@ -1,5 +1,15 @@ ;;; -*- lexical-binding:t -*- +(require 'cl-lib) + +(defun kakafarm/advice-remove-all (function) + "Remove every advice function from FUNCTION." + (advice-mapc + (lambda (advice-function properties-alist) + (advice-remove function + advice-function)) + function)) + (defun kakafarm/call-process-with-string-as-input (program &optional input-string &rest args) (with-temp-buffer (let ((our-output-buffer (current-buffer))) @@ -130,8 +140,9 @@ https://www.tomsdiner.org/blog/post_0003_sourcehut_readme_org_export.html" (car feed-b))) (defun kakafarm/elfeed-sort-feeds (feeds) + "Sort A-FEED, an `elfeed-feeds' list." (sort (mapcar #'kakafarm/elfeed-sort-feed-tags - feeds) + feeds) #'kakafarm/elfeed-compare-feeds-urls)) (defun kakafarm/org-roam-keyword-is-filetags-p (keyword-node) @@ -210,6 +221,81 @@ https://www.tomsdiner.org/blog/post_0003_sourcehut_readme_org_export.html" ".html"))) (defun kakafarm/recenter-top-bottom (original-function &rest arguments) - (if (null (car arguments)) - (apply original-function '(4)) - (apply original-function arguments))) + "Move view such that point is 4 lines from the top of the frame when function is `recenter-top-bottom'." + + (cond + ((null arguments) + (apply function)) + ((null (car arguments)) + (apply original-function '(4))) + (t + (apply original-function arguments)))) + +(defun kakafarm/easy-underscore (arg) + "Convert all inputs of semicolon to an underscore +If given ARG, then it will insert an actual semicolon. + +from https://www.youtube.com/watch?v=6R-73hsL5wk" + (interactive "P") + (message (format "%s" arg)) + (if arg + (insert ";") + (insert "_"))) + +(defun kakafarm/pulse-current-region (&rest _) + "Pulse the selected bit, either the marked region or if there's no +mark, the bit between mark and point... or something like +that... I don't even work here. + +From Goparism (https://www.youtube.com/@goparism) +https://www.youtube.com/watch?v=oQ9JE9kRwG8 which is from the +user 0xMii on R***** which copied it from +who-knows-where-and-who." + (if mark-active + (pulse-momentary-highlight-region (region-beginning) + (region-end)) + (pulse-momentary-highlight-region (mark) + (point)))) + +(defun kakafarm/take-while (lst predp) + (named-let loop ((lst lst) + (accumulator '())) + (cond + ((null lst) + (reverse accumulator)) + ((predp (car lst)) + (reverse accumulator)) + (t + (loop (cdr lst) + accumulator))))) + +(defun kakafarm/drop-while (lst predp) + (named-let loop ((lst lst)) + (cond + (() + lst) + ((predp (car lst)) + (cdr lst)) + (t + (loop (cdr lst)))))) + +(defun kakafarm/url-response-to-body (response) + (cdr (kakafarm/drop-while + (string-split response + "\n") + (lambda (line) + (not (string-blank-p line)))))) + +(defun kakafarm/list-all-http-or-https () + (interactive) + (dolist (url (let* ((list-of-lines + (split-string (substring-no-properties (buffer-string)) + "[ \n]"))) + (cl-reduce (lambda (accumulator line) + (if (string-match-p "https?://.+" + line) + (cons line accumulator) + accumulator)) + list-of-lines + :initial-value '()))) + (message "%s" url)))