Compare commits

...

3 Commits

Author SHA1 Message Date
Case Duckworth 80abceb212 asdpofiuasdpfoiasjdpfoiajsdf 2022-05-27 13:26:19 -05:00
Case Duckworth 41b2867466 Don't inhibit redisplay or message when debugging 2022-05-27 13:25:56 -05:00
Case Duckworth 3da59fb2f6 i'm doing a terrible job 2022-05-25 22:07:33 -05:00
10 changed files with 122 additions and 138 deletions

View File

@ -47,8 +47,9 @@ restore that."
(+set-during-startup 'gc-cons-threshold most-positive-fixnum (* 128 1024 1024))
;; Don't prematurely re-display
(+set-during-startup 'inhibit-redisplay t)
(+set-during-startup 'inhibit-message t)
(unless debug-on-error
(+set-during-startup 'inhibit-redisplay t)
(+set-during-startup 'inhibit-message t))
;; Debug during init
(unless (eq debug-on-error 'startup)

175
init.el
View File

@ -38,7 +38,8 @@
;; good functioning. In this block, I add extra things or more "experimental"
;; ones that might not belong in a separate file.
(:also-load +lisp)
(:option truncate-string-ellipsis "")
(:option truncate-string-ellipsis ""
ring-bell-function 'ignore)
;; Bindings
(:global "C-x C-k" #'kill-current-buffer
"C-x 4 n" #'clone-buffer
@ -51,7 +52,8 @@
"C-w" #'+kill-word-backward-or-region
"C-x C-m" #'execute-extended-command ; original: coding systems
"C-<backspace>" #'+backward-kill-word
"C-x TAB" #'+indent-rigidly)
"C-x TAB" #'+indent-rigidly
"C-x C-c" #'+save-buffers-quit)
;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
(global-set-key (kbd "C-h") 'delete-backward-char)
(keyboard-translate ?\C-h ?\C-?)
@ -104,8 +106,8 @@
(dolist (var '(safe-local-variable-values
warning-suppress-types))
(add-to-list '+custom-variable-allowlist var))
(+ensure-after-init
(+custom-load-ignoring-most-customizations))
(+with-ensure-after-init
(+custom-load-ignoring-most-customizations))
(advice-add #'custom-buffer-create-internal :after #'+cus-edit-expand-widgets)
(:with-mode Custom-mode
(:local-set imenu-generic-expression +cus-edit-imenu-generic-expression)))
@ -146,7 +148,7 @@
(+ensure-after-init #'+key-global-mode))
(setup _work
(+with-ensure-after-init
(with-eval-after-load 'bbdb
(require '_work)))
(setup abbrev
@ -592,7 +594,7 @@
(cons " --- " frame-title-format))
org-clock-string-limit 7 ; just the clock bit
;; org-clock-string-limit 25 ; gives enough information
org-clock-persist t
org-clock-persist nil
org-confirm-babel-evaluate nil
org-cycle-separator-lines 0
org-directory (sync/ "org/" t)
@ -671,12 +673,13 @@
(:global [f8] #'org-clock-in
[f9] #'org-clock-out
"C-c l" #'org-store-link)
(:hook #'variable-pitch-mode
(+with-ensure-after-init
(:hook #'variable-pitch-mode
#'visual-fill-column-mode
#'turn-off-auto-fill
#'org-indent-mode
#'prettify-symbols-mode
#'+org-wrap-on-hyphens)
#'+org-wrap-on-hyphens))
(:local-set prettify-symbols-alist '(("DEADLINE:" . ?→)
("SCHEDULED:" . ?↷)
("CLOSED:" . ?✓))
@ -857,7 +860,7 @@
(setup scratch
(:require +scratch)
(:option initial-major-mode #'lisp-interaction-mode
initial-scratch-message (+scratch-fortune))
initial-scratch-message ";;; What good will you work in the world today?\n\n")
(:+leader "." #'+scratch-switch-to-scratch
"C-." #'+scratch-switch-to-scratch
"," #'+scratch-switch-to-text
@ -912,7 +915,8 @@
+tab-bar-tracking-mode
+tab-bar-notmuch-count
+tab-bar-timer
+tab-bar-date))
+tab-bar-date
+tab-bar-space))
(tab-bar-mode +1)
(display-time-mode +1))
@ -936,6 +940,8 @@
(setup whitespace
(:option whitespace-line-column nil
whitespace-style '(face trailing tabs tab-mark))
;; I want trailing whitespace to be cleaned up, but I don't need to know about it.
(:face 'whitespace-trailing '((t :inherit nil)))
(:hook-into text-mode prog-mode))
(setup (:straight 0x0)
@ -970,12 +976,10 @@
(setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _)
(setq input (orderless-pattern-compiler input))
(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 input (orderless-pattern-compiler input))
(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
"M-s f" #'affe-find)))
@ -1003,9 +1007,8 @@
(:+key "M-j" #'avy-goto-char-timer)
(:bind-into isearch
"M-j" #'avy-isearch)
(:when-loaded
(setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark)
(+avy-buffer-face-mode +1)))
(setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark)
(+avy-buffer-face-mode +1))
(setup (:straight bbdb)
(:straight bbdb-vcard)
@ -1248,7 +1251,7 @@
#'enable-lui-track
#'visual-fill-column-mode
#'enable-lui-autopaste
)
(defun turn-off-electric-pair-mode () (electric-pair-mode -1)))
(:local-set fringes-outside-margins t
right-margin-width (length lui-time-stamp-format)
scroll-margin 0
@ -1259,10 +1262,7 @@
column-number-mode nil
file-percentage-mode nil
visual-fill-column-extra-text-width
(cons +circe-left-margin 0))
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands)
'(flat))))
(cons +circe-left-margin 0)))
(tracking-mode +1)
(:with-mode tracking-mode
@ -1303,7 +1303,8 @@
xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref
tab-always-indent 'complete
completion-in-region-function #'consult-completion-in-region)
;; completion-in-region-function #'consult-completion-in-region
)
(advice-add #'register-preview :override #'consult-register-window)
(dolist (binding '(;; C-c bindings (mode-specific-map)
("C-c h" . consult-history)
@ -1379,43 +1380,10 @@
(comint-mode-map . comint-mode-hook)
(sly-mrepl-mode-map . sly-mrepl-hook)))
(with-eval-after-load 'orderless
(: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)))))
(:option consult--regexp-compiler #'consult--orderless-regexp-compiler))))
(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
:quit "Turns out, I actually like minibuffer completion better.")
(+with-ensure-after-init
(corfu-global-mode +1)))
(setup (:straight corfu)
(global-corfu-mode +1))
(setup (:straight crossword)
;; This isn't the perfect Emacs crossword puzzle, but it's the only one I
@ -1585,11 +1553,7 @@
(:bind "C-." #'embark-act
"M-." #'embark-dwim))
(:with-map embark-file-map
(:bind "l" #'vlf))
;; Integrations
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'embark-prefix-help-command vertico-multiform-commands)
nil)))
(:bind "l" #'vlf)))
(setup (:straight embark-consult)
(:load-after consult embark)
@ -1685,9 +1649,7 @@
(:option flyspell-correct--cr-key ";")
(:bind-into flyspell
"C-;" #'flyspell-correct-wrapper
"<f7>" #'+flyspell-correct-buffer)
(with-eval-after-load 'vertico-multiform
(setf (alist-get 'flyspell vertico-multiform-categories) nil)))
"<f7>" #'+flyspell-correct-buffer))
(setup (:straight focus)
(:require)
@ -1763,12 +1725,6 @@
"<f1> v" #'helpful-variable
"<f1> k" #'helpful-key
"<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
;; (see https://github.com/Wilfred/helpful/issues/236)
(run-with-idle-timer 1 nil (lambda ()
@ -1776,8 +1732,8 @@
(info-lookup-setup-mode 'symbol 'emacs-lisp-mode))))
(setup (:straight (hippie-completing-read
:host github
:repo "duckwork/hippie-completing-read"))
:host nil
:repo "https://codeberg.org/acdw/hippie-completing-read.el"))
(:+key "M-/" #'hippie-completing-read))
(setup (:straight hungry-delete)
@ -1916,10 +1872,7 @@
(keychain-refresh-environment))
(setup (:straight lacarte)
(:+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)))))
(:+key "<f10>" #'lacarte-execute-menu-command))
(setup (:straight (lin :host nil
:repo "https://git.sr.ht/~protesilaos/lin"))
@ -1965,7 +1918,11 @@
lisp-interaction-mode-map))
(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)
(marginalia-mode +1))
@ -2050,10 +2007,6 @@
(defun +modus-themes-mostly-monochrome ()
"Set up mdous-themes to be mostly monochrome."
;; Major mode in the mode-line
(defface +modeline-text-mode-face nil
"Text-mode major mode face.")
(defface +modeline-prog-mode-face nil
"Prog-mode major mode face.")
(modus-themes-with-colors
(custom-set-faces
`(font-lock-builtin-face
@ -2063,7 +2016,8 @@
((,class :inherit variable-pitch
:foreground ,fg-comment-yellow)))
`(font-lock-comment-delimiter-face
((,class :inherit font-lock-comment-face)))
((,class :inherit fixed-pitch
:foreground ,fg-comment-yellow)))
`(font-lock-constant-face
((,class :inherit underline
:foreground unspecified)))
@ -2099,16 +2053,13 @@
((,class :inherit font-lock-comment-face
:foreground ,fg-header
:background ,yellow-intense-bg)))
`(+modeline-text-mode-face
((,class :foreground ,blue
:inherit modus-themes-bold)))
`(+modeline-prog-mode-face
((,class :foreground ,magenta
:inherit modus-themes-bold))))
(:option +modeline-major-mode-faces
`((text-mode . +modeline-text-mode-face)
(prog-mode . +modeline-prog-mode-face)
(t . bold))))))
;; `(mode-line
;; ((,class :height 100)))
;; `(mode-line-inactive
;; ((,class :height 100)))
;; `(tab-bar
;; ((,class :height 100)))
))))
(require 'dawn)
(dawn-schedule #'modus-themes-load-operandi
@ -2145,6 +2096,13 @@
(:hook #'visual-fill-column-mode)
(: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 orderless)
@ -2344,17 +2302,18 @@
+modeline-ace-window-display
+modeline-modified
+modeline-buffer-name
+modeline-major-mode
(lambda () (+modeline-vc " : "))
+modeline-anzu
+modeline-nyan-on-focused
)
( ; right
simple-modeline-segment-process
(lambda ()
(unless +tab-bar-misc-info-mode
(+modeline-concat
'(+modeline-track
simple-modeline-segment-misc-info))))
+modeline-position
simple-modeline-segment-process
,(+modeline-concat
'(+modeline-god-mode
+modeline-kmacro-indicator
@ -2363,8 +2322,9 @@
+modeline-text-scale
+modeline-input-method)
" ")
+modeline-major-mode
+modeline-spacer)))
+modeline-position
+modeline-spacer
)))
(simple-modeline-mode +1))
(setup (:straight slack)
@ -2409,7 +2369,6 @@
#'describe-gnu-project
#'suspend-frame)
(sophomore-disable-with 'confirm
#'+save-buffers-quit
#'save-buffers-kill-terminal)
(sophomore-mode +1))
@ -2484,6 +2443,12 @@
trashed-use-header-line t
trashed-size-format 'human-readable))
(setup (:straight (twtxt
:fork (:repo "duckwork/twtxt-el")))
(:option twtxt-file "/sshx:hetzner:/var/www/acdw.casa/tw.txt"
twtxt-following '(("acdw" "https://acdw.casa/tw.txt")))
(+with-ensure-after-init (:require)))
(setup (:straight undo-fu)
(:option undo-fu-allow-undo-in-region t)
(:global "C-/" #'undo-fu-only-undo
@ -2532,20 +2497,8 @@
;; Extensions
(:also-load vertico-directory
vertico-mouse
vertico-unobtrusive
vertico-multiform
vertico-quick)
(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
(:bind "RET" #'vertico-directory-enter
"DEL" #'vertico-directory-delete-char

View File

@ -62,7 +62,7 @@
(setq buffer-face-mode-face +avy-buffer-face-mode-face)
(buffer-face-mode +1)))
(define-minor-mode +avy-buffer-face-local-mode
(define-minor-mode +avy-buffer-face-mode
"Turn off `buffer-face-mode' before doing Avy selections.
Restore the mode after the selection."
:lighter ""

View File

@ -46,20 +46,24 @@ If multiple items are selected, don't advance."
(message "[Elfeed] Update in progress")
'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.")
(defcustom +elfeed-update-niceness 15
"How \"nice\" `+elfeed-update-command' should be."
:type 'integer
:group 'elfeed)
(defcustom +elfeed-update-lockfile
(expand-file-name "+elfeed-update-lock" (temporary-file-directory))
"The file to ")
(defun +elfeed-update-command ()
(interactive)
(unless (or +elfeed--update-running
(unless (or +elfeed--update-running-p
(derived-mode-p 'elfeed-show-mode 'elfeed-search-mode))
(let ((script (expand-file-name "/tmp/elfeed-update.el"))
(update-message-format "[Elfeed] Background update: %s"))
(setq +elfeed--update-running t)
(setq +elfeed--update-running-p t)
(elfeed-db-save)
(advice-add 'elfeed :override #'+elfeed--update-message)
(ignore-errors (kill-buffer "*elfeed-search*"))
@ -128,7 +132,7 @@ If multiple items are selected, don't advance."
script))
(lambda (proc stat)
(advice-remove 'elfeed #'+elfeed--update-message)
(setq +elfeed--update-running nil)
(setq +elfeed--update-running-p nil)
(unless (string= stat "killed")
(setq +elfeed--update-count (1+ +elfeed--update-count)))
(message update-message-format (string-trim stat)))))))
@ -152,7 +156,7 @@ non-nil, proceed."
(defun +elfeed--cancel-update-timer ()
"Cancel `+elfeed--update-timer'."
(unless +elfeed--update-running
(unless +elfeed--update-running-p
(ignore-errors (cancel-timer +elfeed--update-timer))
(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-trailing-whitespace t
tab-bar-show 1
tab-width 4
tab-width 8 ; so alignment expecting the default looks right
tramp-backup-directory-alist backup-directory-alist
undo-limit 100000000 ; 10 MB
use-dialog-box nil

View File

@ -9,6 +9,7 @@
;;; Code:
(require '+util)
(require 'actually-selected-window)
(require 'simple-modeline)
(require 'minions)
@ -138,6 +139,9 @@ in the cdr will be applied to the major-mode in the mode line."
:type '(alist :key-type function
:value-type face))
(defface +modeline-major-mode-face nil
"Face for modeline major-mode.")
(defun +modeline-major-mode (&optional spacer)
"Display the current `major-mode'."
(+modeline-spacer nil spacer
@ -149,10 +153,11 @@ in the cdr will be applied to the major-mode in the mode line."
;; simply detect which mode it's in when I change major
;; modes (`change-major-mode-hook') and change the face
;; there, probably.
(catch :done (dolist (cel +modeline-major-mode-faces)
(when (derived-mode-p (car cel))
(throw :done (cdr cel))))
(alist-get t +modeline-major-mode-faces)))
;; (catch :done (dolist (cel +modeline-major-mode-faces)
;; (when (derived-mode-p (car cel))
;; (throw :done (cdr cel))))
;; (alist-get t +modeline-major-mode-faces))
'+modeline-major-mode-face)
'keymap (let ((map (make-sparse-keymap)))
(bindings--define-key map [mode-line down-mouse-1]
`(menu-item "Menu Bar" ignore
@ -468,5 +473,13 @@ to a function in the current buffer, call that function instead."
(kmacro-end-macro nil)))))
'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)
;;; +modeline.el ends here

View File

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

View File

@ -7,6 +7,7 @@
;;; Code:
(require 'acdw)
(require 'tab-bar)
(defface +tab-bar-extra
@ -17,6 +18,10 @@
;; Common
(defun +tab-bar-space (&optional n)
"Display a space N characters long, or 1."
`((space menu-item ,(+string-repeat (or n 1) " ") ignore)))
(defun +tab-bar-misc-info ()
"Display `mode-line-misc-info', formatted for the tab-bar."
`((misc-info menu-item ,(string-trim-right
@ -31,7 +36,7 @@
"Display `tracking-mode-line-buffers' in the tab-bar."
;; TODO: write something to convert a mode-line construct to a tab-bar
;; construct.
(when (and tracking-mode
(when (and (bound-and-true-p tracking-mode)
(not (and +tracking-hide-when-org-clocking
(bound-and-true-p org-clock-current-task))))
(cons (when (> (length tracking-mode-line-buffers) 0)
@ -66,7 +71,7 @@
"Display `display-time-string' in the tab-bar."
(when display-time-mode
`((date-time-string menu-item
,(propertize (concat " " display-time-string))
,(substring-no-properties (concat " " (string-trim display-time-string)))
(lambda (ev)
(interactive "e")
(popup-menu

View File

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

View File

@ -9,11 +9,11 @@
(defun +bob-set-faces (&rest _)
(let ((base-face "IBM Plex Mono")
(base-size 105)
(base-size 110)
(italic-face nil)
;; (bold-face nil)
(mono-face nil)
(var-face "IBM Plex Serif")
(var-face "IBM Plex Sans")
(var-size 1.0))
(+set-faces
`((default