asdpofiuasdpfoiasjdpfoiajsdf

This commit is contained in:
Case Duckworth 2022-05-27 13:26:19 -05:00
parent 41b2867466
commit 80abceb212
8 changed files with 83 additions and 115 deletions

130
init.el
View File

@ -38,7 +38,8 @@
;; good functioning. In this block, I add extra things or more "experimental" ;; good functioning. In this block, I add extra things or more "experimental"
;; ones that might not belong in a separate file. ;; ones that might not belong in a separate file.
(:also-load +lisp) (:also-load +lisp)
(:option truncate-string-ellipsis "") (:option truncate-string-ellipsis ""
ring-bell-function 'ignore)
;; Bindings ;; Bindings
(:global "C-x C-k" #'kill-current-buffer (:global "C-x C-k" #'kill-current-buffer
"C-x 4 n" #'clone-buffer "C-x 4 n" #'clone-buffer
@ -52,7 +53,7 @@
"C-x C-m" #'execute-extended-command ; original: coding systems "C-x C-m" #'execute-extended-command ; original: coding systems
"C-<backspace>" #'+backward-kill-word "C-<backspace>" #'+backward-kill-word
"C-x TAB" #'+indent-rigidly "C-x TAB" #'+indent-rigidly
"C-x C-c" nil) "C-x C-c" #'+save-buffers-quit)
;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults ;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
(global-set-key (kbd "C-h") 'delete-backward-char) (global-set-key (kbd "C-h") 'delete-backward-char)
(keyboard-translate ?\C-h ?\C-?) (keyboard-translate ?\C-h ?\C-?)
@ -105,8 +106,8 @@
(dolist (var '(safe-local-variable-values (dolist (var '(safe-local-variable-values
warning-suppress-types)) warning-suppress-types))
(add-to-list '+custom-variable-allowlist var)) (add-to-list '+custom-variable-allowlist var))
(+ensure-after-init (+with-ensure-after-init
(+custom-load-ignoring-most-customizations)) (+custom-load-ignoring-most-customizations))
(advice-add #'custom-buffer-create-internal :after #'+cus-edit-expand-widgets) (advice-add #'custom-buffer-create-internal :after #'+cus-edit-expand-widgets)
(:with-mode Custom-mode (:with-mode Custom-mode
(:local-set imenu-generic-expression +cus-edit-imenu-generic-expression))) (:local-set imenu-generic-expression +cus-edit-imenu-generic-expression)))
@ -147,7 +148,7 @@
(+ensure-after-init #'+key-global-mode)) (+ensure-after-init #'+key-global-mode))
(setup _work (setup _work
(+with-ensure-after-init (with-eval-after-load 'bbdb
(require '_work))) (require '_work)))
(setup abbrev (setup abbrev
@ -672,12 +673,13 @@
(:global [f8] #'org-clock-in (:global [f8] #'org-clock-in
[f9] #'org-clock-out [f9] #'org-clock-out
"C-c l" #'org-store-link) "C-c l" #'org-store-link)
(:hook #'variable-pitch-mode (+with-ensure-after-init
(:hook #'variable-pitch-mode
#'visual-fill-column-mode #'visual-fill-column-mode
#'turn-off-auto-fill #'turn-off-auto-fill
#'org-indent-mode #'org-indent-mode
#'prettify-symbols-mode #'prettify-symbols-mode
#'+org-wrap-on-hyphens) #'+org-wrap-on-hyphens))
(:local-set prettify-symbols-alist '(("DEADLINE:" . ?→) (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→)
("SCHEDULED:" . ?↷) ("SCHEDULED:" . ?↷)
("CLOSED:" . ?✓)) ("CLOSED:" . ?✓))
@ -974,12 +976,10 @@
(setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _) (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _)
(setq input (orderless-pattern-compiler input)) (setq input (orderless-pattern-compiler input))
(cons input (lambda (str) (orderless--highlight input str))))) (cons input (lambda (str) (orderless--highlight input str)))))
(+with-eval-after-loads (affe vertico-multiform) (+with-eval-after-loads (affe)
(setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _) (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _)
(setq input (orderless-pattern-compiler input)) (setq input (orderless-pattern-compiler input))
(cons input (lambda (str) (orderless--highlight input str))))) (cons input (lambda (str) (orderless--highlight input str)))))
(setf (alist-get 'affe-grep vertico-multiform-commands) nil
(alist-get 'affe-find vertico-multiform-commands) nil)
(:+key "M-s g" #'affe-grep (:+key "M-s g" #'affe-grep
"M-s f" #'affe-find))) "M-s f" #'affe-find)))
@ -1262,10 +1262,7 @@
column-number-mode nil column-number-mode nil
file-percentage-mode nil file-percentage-mode nil
visual-fill-column-extra-text-width visual-fill-column-extra-text-width
(cons +circe-left-margin 0)) (cons +circe-left-margin 0)))
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands)
'(flat))))
(tracking-mode +1) (tracking-mode +1)
(:with-mode tracking-mode (:with-mode tracking-mode
@ -1383,41 +1380,10 @@
(comint-mode-map . comint-mode-hook) (comint-mode-map . comint-mode-hook)
(sly-mrepl-mode-map . sly-mrepl-hook))) (sly-mrepl-mode-map . sly-mrepl-hook)))
(with-eval-after-load 'orderless (with-eval-after-load 'orderless
(:option consult--regexp-compiler #'consult--orderless-regexp-compiler)) (:option consult--regexp-compiler #'consult--orderless-regexp-compiler))))
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'consult-buffer vertico-multiform-commands) '(flat))
(dolist (buf-cmd '(consult-find
consult-flymake
consult-focus-lines
consult-git-grep
consult-grep
consult-imenu
consult-imenu-multi
consult-keep-lines
consult-line
consult-line-multi
consult-locate
consult-multi-occur
consult-outline
consult-ripgrep
consult-yank-pop))
(setf (alist-get buf-cmd vertico-multiform-commands) nil)))))
(setup (:straight consult-dir)
(:load-after consult)
(:+key "C-x C-d" #'consult-dir)
(:with-map vertico-map
(:bind "C-x C-d" #'consult-dir
"C-x C-j" #'consult-dir-jump-file)))
(setup (:straight consult-notmuch)
(:load-after consult notmuch)
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'consult-notmuch vertico-multiform-commands) nil
(alist-get 'consult-notmuch-tree vertico-multiform-commands) nil)))
(setup (:straight corfu) (setup (:straight corfu)
(corfu-global-mode +1)) (global-corfu-mode +1))
(setup (:straight crossword) (setup (:straight crossword)
;; This isn't the perfect Emacs crossword puzzle, but it's the only one I ;; This isn't the perfect Emacs crossword puzzle, but it's the only one I
@ -1587,11 +1553,7 @@
(:bind "C-." #'embark-act (:bind "C-." #'embark-act
"M-." #'embark-dwim)) "M-." #'embark-dwim))
(:with-map embark-file-map (:with-map embark-file-map
(:bind "l" #'vlf)) (:bind "l" #'vlf)))
;; Integrations
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'embark-prefix-help-command vertico-multiform-commands)
nil)))
(setup (:straight embark-consult) (setup (:straight embark-consult)
(:load-after consult embark) (:load-after consult embark)
@ -1687,9 +1649,7 @@
(:option flyspell-correct--cr-key ";") (:option flyspell-correct--cr-key ";")
(:bind-into flyspell (:bind-into flyspell
"C-;" #'flyspell-correct-wrapper "C-;" #'flyspell-correct-wrapper
"<f7>" #'+flyspell-correct-buffer) "<f7>" #'+flyspell-correct-buffer))
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'flyspell vertico-multiform-categories) nil)))
(setup (:straight focus) (setup (:straight focus)
(:require) (:require)
@ -1765,12 +1725,6 @@
"<f1> v" #'helpful-variable "<f1> v" #'helpful-variable
"<f1> k" #'helpful-key "<f1> k" #'helpful-key
"<f1> ." #'helpful-at-point) "<f1> ." #'helpful-at-point)
(with-eval-after-load 'vertico-multiform
(dolist (cmd '(describe-symbol ; describe-* included here for completeness
describe-function describe-variable
helpful-function helpful-macro helpful-callable
helpful-variable))
(setf (alist-get cmd vertico-multiform-commands) nil)))
;; Load faster on first invocation by pre-loading a slow function ;; Load faster on first invocation by pre-loading a slow function
;; (see https://github.com/Wilfred/helpful/issues/236) ;; (see https://github.com/Wilfred/helpful/issues/236)
(run-with-idle-timer 1 nil (lambda () (run-with-idle-timer 1 nil (lambda ()
@ -1778,8 +1732,8 @@
(info-lookup-setup-mode 'symbol 'emacs-lisp-mode)))) (info-lookup-setup-mode 'symbol 'emacs-lisp-mode))))
(setup (:straight (hippie-completing-read (setup (:straight (hippie-completing-read
:host github :host nil
:repo "duckwork/hippie-completing-read")) :repo "https://codeberg.org/acdw/hippie-completing-read.el"))
(:+key "M-/" #'hippie-completing-read)) (:+key "M-/" #'hippie-completing-read))
(setup (:straight hungry-delete) (setup (:straight hungry-delete)
@ -1918,10 +1872,7 @@
(keychain-refresh-environment)) (keychain-refresh-environment))
(setup (:straight lacarte) (setup (:straight lacarte)
(:+key "<f10>" #'lacarte-execute-menu-command) (:+key "<f10>" #'lacarte-execute-menu-command))
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'lacarte-execute-menu-command vertico-multiform-commands)
'(buffer grid (vertico-sort-function . vertico-sort-length-alpha)))))
(setup (:straight (lin :host nil (setup (:straight (lin :host nil
:repo "https://git.sr.ht/~protesilaos/lin")) :repo "https://git.sr.ht/~protesilaos/lin"))
@ -1967,7 +1918,11 @@
lisp-interaction-mode-map)) lisp-interaction-mode-map))
(define-key (symbol-value m) (kbd "C-c e") #'macrostep-expand))) (define-key (symbol-value m) (kbd "C-c e") #'macrostep-expand)))
(setup (:straight (magit :host github :repo "magit/magit"))) (setup (:straight (magit :host github :repo "magit/magit"
:build (:not compile))
(:straight (transient :host github :repo "magit/transient"
:build (:not compile))))
(autoload 'transient--with-suspended-override "transient"))
(setup (:straight marginalia) (setup (:straight marginalia)
(marginalia-mode +1)) (marginalia-mode +1))
@ -2098,12 +2053,13 @@
((,class :inherit font-lock-comment-face ((,class :inherit font-lock-comment-face
:foreground ,fg-header :foreground ,fg-header
:background ,yellow-intense-bg))) :background ,yellow-intense-bg)))
`(mode-line ;; `(mode-line
((,class :height 100))) ;; ((,class :height 100)))
`(mode-line-inactive ;; `(mode-line-inactive
((,class :height 100))) ;; ((,class :height 100)))
`(tab-bar ;; `(tab-bar
((,class :height 100))))))) ;; ((,class :height 100)))
))))
(require 'dawn) (require 'dawn)
(dawn-schedule #'modus-themes-load-operandi (dawn-schedule #'modus-themes-load-operandi
@ -2140,6 +2096,13 @@
(:hook #'visual-fill-column-mode) (:hook #'visual-fill-column-mode)
(:file-match (rx ".epub" eos))) (:file-match (rx ".epub" eos)))
(setup (:straight nyan-mode)
(:require)
;; For some reason, in some modes the mode-line isn't updated after these
;; commands. I think it might have to do with `+modeline-position-function'.
(advice-add 'end-of-buffer :after #'force-mode-line-update)
(advice-add 'beginning-of-buffer :after #'force-mode-line-update))
(setup (:straight ol-notmuch)) (setup (:straight ol-notmuch))
(setup (:straight orderless) (setup (:straight orderless)
@ -2342,6 +2305,7 @@
+modeline-major-mode +modeline-major-mode
(lambda () (+modeline-vc " : ")) (lambda () (+modeline-vc " : "))
+modeline-anzu +modeline-anzu
+modeline-nyan-on-focused
) )
( ; right ( ; right
simple-modeline-segment-process simple-modeline-segment-process
@ -2350,7 +2314,6 @@
(+modeline-concat (+modeline-concat
'(+modeline-track '(+modeline-track
simple-modeline-segment-misc-info)))) simple-modeline-segment-misc-info))))
simple-modeline-segment-process
,(+modeline-concat ,(+modeline-concat
'(+modeline-god-mode '(+modeline-god-mode
+modeline-kmacro-indicator +modeline-kmacro-indicator
@ -2360,7 +2323,7 @@
+modeline-input-method) +modeline-input-method)
" ") " ")
+modeline-position +modeline-position
;; +modeline-spacer +modeline-spacer
))) )))
(simple-modeline-mode +1)) (simple-modeline-mode +1))
@ -2483,7 +2446,8 @@
(setup (:straight (twtxt (setup (:straight (twtxt
:fork (:repo "duckwork/twtxt-el"))) :fork (:repo "duckwork/twtxt-el")))
(:option twtxt-file "/sshx:hetzner:/var/www/acdw.casa/tw.txt" (:option twtxt-file "/sshx:hetzner:/var/www/acdw.casa/tw.txt"
twtxt-following '(("acdw" "https://acdw.casa/tw.txt")))) twtxt-following '(("acdw" "https://acdw.casa/tw.txt")))
(+with-ensure-after-init (:require)))
(setup (:straight undo-fu) (setup (:straight undo-fu)
(:option undo-fu-allow-undo-in-region t) (:option undo-fu-allow-undo-in-region t)
@ -2533,20 +2497,8 @@
;; Extensions ;; Extensions
(:also-load vertico-directory (:also-load vertico-directory
vertico-mouse vertico-mouse
vertico-unobtrusive
vertico-multiform
vertico-quick) vertico-quick)
(vertico-mouse-mode +1) (vertico-mouse-mode +1)
(vertico-multiform-mode +1)
;; I `setf' these so they don't override the other setfs elsewhere in init.el.
(setf (alist-get 'execute-extended-command vertico-multiform-commands) '(flat))
(setf (alist-get 'completion-at-point vertico-multiform-commands) '(flat))
(setf (alist-get 'indent-for-tab-command vertico-multiform-commands) '(flat))
(setf (alist-get 'insert-char vertico-multiform-commands) nil)
(setf (alist-get 'file vertico-multiform-categories) nil)
(setf (alist-get 'bookmark vertico-multiform-categories) nil)
;; Default. Needs to be `add-to-list' so that it appears at the end.
(add-to-list 'vertico-multiform-categories '(t flat) :append)
(:with-map vertico-map (:with-map vertico-map
(:bind "RET" #'vertico-directory-enter (:bind "RET" #'vertico-directory-enter
"DEL" #'vertico-directory-delete-char "DEL" #'vertico-directory-delete-char

View File

@ -46,20 +46,24 @@ If multiple items are selected, don't advance."
(message "[Elfeed] Update in progress") (message "[Elfeed] Update in progress")
'ignore) 'ignore)
(defvar +elfeed--update-running nil "Whether an update is currently running.") (defvar +elfeed--update-running-p nil "Whether an update is currently running.")
(defvar +elfeed--update-count 0 "How many times `+elfeed-update-command' has run.") (defvar +elfeed--update-count 0 "How many times `+elfeed-update-command' has run.")
(defcustom +elfeed-update-niceness 15 (defcustom +elfeed-update-niceness 15
"How \"nice\" `+elfeed-update-command' should be." "How \"nice\" `+elfeed-update-command' should be."
:type 'integer :type 'integer
:group 'elfeed) :group 'elfeed)
(defcustom +elfeed-update-lockfile
(expand-file-name "+elfeed-update-lock" (temporary-file-directory))
"The file to ")
(defun +elfeed-update-command () (defun +elfeed-update-command ()
(interactive) (interactive)
(unless (or +elfeed--update-running (unless (or +elfeed--update-running-p
(derived-mode-p 'elfeed-show-mode 'elfeed-search-mode)) (derived-mode-p 'elfeed-show-mode 'elfeed-search-mode))
(let ((script (expand-file-name "/tmp/elfeed-update.el")) (let ((script (expand-file-name "/tmp/elfeed-update.el"))
(update-message-format "[Elfeed] Background update: %s")) (update-message-format "[Elfeed] Background update: %s"))
(setq +elfeed--update-running t) (setq +elfeed--update-running-p t)
(elfeed-db-save) (elfeed-db-save)
(advice-add 'elfeed :override #'+elfeed--update-message) (advice-add 'elfeed :override #'+elfeed--update-message)
(ignore-errors (kill-buffer "*elfeed-search*")) (ignore-errors (kill-buffer "*elfeed-search*"))
@ -128,7 +132,7 @@ If multiple items are selected, don't advance."
script)) script))
(lambda (proc stat) (lambda (proc stat)
(advice-remove 'elfeed #'+elfeed--update-message) (advice-remove 'elfeed #'+elfeed--update-message)
(setq +elfeed--update-running nil) (setq +elfeed--update-running-p nil)
(unless (string= stat "killed") (unless (string= stat "killed")
(setq +elfeed--update-count (1+ +elfeed--update-count))) (setq +elfeed--update-count (1+ +elfeed--update-count)))
(message update-message-format (string-trim stat))))))) (message update-message-format (string-trim stat)))))))
@ -152,7 +156,7 @@ non-nil, proceed."
(defun +elfeed--cancel-update-timer () (defun +elfeed--cancel-update-timer ()
"Cancel `+elfeed--update-timer'." "Cancel `+elfeed--update-timer'."
(unless +elfeed--update-running (unless +elfeed--update-running-p
(ignore-errors (cancel-timer +elfeed--update-timer)) (ignore-errors (cancel-timer +elfeed--update-timer))
(setq +elfeed--update-timer nil))) (setq +elfeed--update-timer nil)))

View File

@ -121,7 +121,7 @@ Do this only if the buffer is not visiting a file."
show-paren-when-point-inside-paren t show-paren-when-point-inside-paren t
;;show-trailing-whitespace t ;;show-trailing-whitespace t
tab-bar-show 1 tab-bar-show 1
tab-width 4 tab-width 8 ; so alignment expecting the default looks right
tramp-backup-directory-alist backup-directory-alist tramp-backup-directory-alist backup-directory-alist
undo-limit 100000000 ; 10 MB undo-limit 100000000 ; 10 MB
use-dialog-box nil use-dialog-box nil

View File

@ -9,6 +9,7 @@
;;; Code: ;;; Code:
(require '+util) (require '+util)
(require 'actually-selected-window)
(require 'simple-modeline) (require 'simple-modeline)
(require 'minions) (require 'minions)
@ -472,5 +473,13 @@ to a function in the current buffer, call that function instead."
(kmacro-end-macro nil))))) (kmacro-end-macro nil)))))
'mouse-face 'mode-line-highlight)))) 'mouse-face 'mode-line-highlight))))
(defun +modeline-nyan-on-focused (&optional spacer)
"Display the cat from `nyan-mode', but only on the focused window."
(require 'nyan-mode)
(when (actually-selected-window-p)
(concat (or spacer "") (nyan-create)
(propertize "."
'face 'font-lock-comment-face))))
(provide '+modeline) (provide '+modeline)
;;; +modeline.el ends here ;;; +modeline.el ends here

View File

@ -80,21 +80,22 @@ If PATH does not exist, abort the evaluation."
;;; Straight.el ;;; Straight.el
(with-eval-after-load 'straight (defun setup--straight-handle-arg (arg var)
(defun setup--straight-handle-arg (arg var) (cond
(cond ((and (boundp var) (symbol-value var)) t)
((and (boundp var) (symbol-value var)) t) ((keywordp arg) (set var t))
((keywordp arg) (set var t)) ((functionp arg) (set var nil) (funcall arg))
((functionp arg) (set var nil) (funcall arg)) ((listp arg) (set var nil) arg)))
((listp arg) (set var nil) (eval arg :lexical))))
(with-eval-after-load 'straight
(setup-define :straight (setup-define :straight
(lambda (recipe &rest predicates) (lambda (recipe &rest predicates)
(let* ((skp (make-symbol "straight-keyword-p")) (let* ((skp (make-symbol "straight-keyword-p"))
(straight-use-p (straight-use-p
(cl-every (lambda (f) (setup--straight-handle-arg f skp)) (cl-mapcar
predicates)) (lambda (f) (setup--straight-handle-arg f skp))
(form `(unless (and ,straight-use-p predicates))
(form `(unless (and ,@straight-use-p
(condition-case e (condition-case e
(straight-use-package ',recipe) (straight-use-package ',recipe)
(error (error

View File

@ -7,6 +7,7 @@
;;; Code: ;;; Code:
(require 'acdw)
(require 'tab-bar) (require 'tab-bar)
(defface +tab-bar-extra (defface +tab-bar-extra
@ -35,7 +36,7 @@
"Display `tracking-mode-line-buffers' in the tab-bar." "Display `tracking-mode-line-buffers' in the tab-bar."
;; TODO: write something to convert a mode-line construct to a tab-bar ;; TODO: write something to convert a mode-line construct to a tab-bar
;; construct. ;; construct.
(when (and tracking-mode (when (and (bound-and-true-p tracking-mode)
(not (and +tracking-hide-when-org-clocking (not (and +tracking-hide-when-org-clocking
(bound-and-true-p org-clock-current-task)))) (bound-and-true-p org-clock-current-task))))
(cons (when (> (length tracking-mode-line-buffers) 0) (cons (when (> (length tracking-mode-line-buffers) 0)
@ -261,14 +262,8 @@ name to the left."
(require 'shr) ; `shr-string-pixel-width' (require 'shr) ; `shr-string-pixel-width'
(let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format))) (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format)))
(rest (tab-bar-format-list rest)) (rest (tab-bar-format-list rest))
(rest (mapconcat (lambda (item) x(nth 2 item)) rest "")) (rest (mapconcat (lambda (item) (nth 2 item)) rest ""))
(hpos (hpos (shr-string-pixel-width rest))
;; I have to rewrite `shr-string-pixel-width' to take the tab-bar face
;; into account.
(let ((pt (point)))
(prog1 (with-temp-buffer (insert (propertize rest 'face 'tab-bar))
(shr-pixel-column))
(goto-char pt))))
(str (propertize " " 'display `(space :align-to (- right (,hpos)))))) (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
`((align-right menu-item ,str ignore)))) `((align-right menu-item ,str ignore))))

View File

@ -288,6 +288,13 @@ always nil; this function is mostly intended for use in init."
:type '(repeat function) :type '(repeat function)
:group 'applications) :group 'applications)
(defun +string-repeat (n str)
"Repeat STR N times."
(let ((r ""))
(dotimes (_ n)
(setq r (concat r str)))
r))
(defun chat-disconnect () (defun chat-disconnect ()
"Disconnect from all chats." "Disconnect from all chats."
(interactive) (interactive)

View File

@ -13,7 +13,7 @@
(italic-face nil) (italic-face nil)
;; (bold-face nil) ;; (bold-face nil)
(mono-face nil) (mono-face nil)
(var-face "IBM Plex Serif") (var-face "IBM Plex Sans")
(var-size 1.0)) (var-size 1.0))
(+set-faces (+set-faces
`((default `((default