This commit is contained in:
Case Duckworth 2022-03-11 20:04:05 -06:00
parent 8eda323c31
commit f6512fe1bd
11 changed files with 191 additions and 120 deletions

View File

@ -140,10 +140,9 @@ See `no-littering' for examples.")
(add-to-list 'setup-modifier-list 'setup-wrap-to-demote-errors) (add-to-list 'setup-modifier-list 'setup-wrap-to-demote-errors)
(unless (memq debug-on-error '(nil init)) (unless (memq debug-on-error '(nil init))
(define-advice setup (:before (head &rest args) +setup-before) (define-advice setup (:around (fn head &rest args) +setup-report)
(message "[Setup] %S" head)) (+with-progress ((format "[Setup] %S..." head))
(define-advice setup (:after (head &rest args) +setup-after) (apply fn head args))))
(message "[Setup] %S...done" head)))
;;; Appendix ;;; Appendix

47
init.el
View File

@ -465,7 +465,7 @@
(setup notmuch (setup notmuch
(:load-from "~/usr/share/emacs/site-lisp/") (:load-from "~/usr/share/emacs/site-lisp/")
;;(:load-after org-contacts) (:load-after org-contacts)
(:also-load +notmuch +message) (:also-load +notmuch +message)
(+define-dir notmuch/ (sync/ "emacs/notmuch") (+define-dir notmuch/ (sync/ "emacs/notmuch")
"Notmuch configuration and data.") "Notmuch configuration and data.")
@ -568,11 +568,11 @@
org-startup-truncated nil org-startup-truncated nil
org-startup-with-inline-images t org-startup-with-inline-images t
org-tags-column (- (- fill-column (length org-ellipsis))) org-tags-column (- (- fill-column (length org-ellipsis)))
org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" "ONGOING(o@)"
"|" "DONE(d!)") "|" "DONE(d!)")
(sequence "ONGOING(o@)")
(sequence "|" "CANCELED(k@)") (sequence "|" "CANCELED(k@)")
(sequence "MEETING(m)")) (sequence "MEETING(m)")
(sequence "ASSIGNED(a@/!)" "REVIEW(r)" "|" "DONE(d!)"))
org-emphasis-alist '(("*" org-bold) org-emphasis-alist '(("*" org-bold)
("/" org-italic) ("/" org-italic)
("_" org-underline) ("_" org-underline)
@ -698,8 +698,8 @@
:unnarrowed t)) :unnarrowed t))
(+org-capture-sort)) (+org-capture-sort))
(setup org-contacts (setup org-contacts (:quit)
(:load-after org) (:require)
(:also-straight org-vcard) ; for importing Vcard files (:also-straight org-vcard) ; for importing Vcard files
(:option org-contacts-matcher "contact") ; Contacts are tagged "contact" (:option org-contacts-matcher "contact") ; Contacts are tagged "contact"
) )
@ -854,6 +854,12 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
(:when-loaded (:when-loaded
(setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark))) (setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark)))
(setup (:straight bbdb)
(:require bbdb-autoloads
bbdb)
(:also-straight bbdb-vcard)
(bbdb-initialize 'gnus 'message))
(setup (:straight (bongo :type git (setup (:straight (bongo :type git
:flavor melpa :flavor melpa
:files ("*.el" "*.texi" "images" "*.rb" "bongo-pkg.el" "*.info") :files ("*.el" "*.texi" "images" "*.rb" "bongo-pkg.el" "*.info")
@ -1344,7 +1350,9 @@ See also `crux-reopen-as-root-mode'."
(:+leader "f" #'elfeed "C-f" #'elfeed) (:+leader "f" #'elfeed "C-f" #'elfeed)
(advice-add #'elfeed-search-fetch :after #'beginning-of-buffer) (advice-add #'elfeed-search-fetch :after #'beginning-of-buffer)
(:with-mode elfeed-search-mode (:with-mode elfeed-search-mode
(:bind "&" #'+elfeed-search-browse-generic) (:bind "&" #'+elfeed-search-browse-generic
"w" #'elfeed-search-yank
"y" nil)
(:hook #'hl-line-mode) (:hook #'hl-line-mode)
;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/
(advice-add #'elfeed-search-update--force :after #'elfeed-db-save) (advice-add #'elfeed-search-update--force :after #'elfeed-db-save)
@ -1353,7 +1361,9 @@ See also `crux-reopen-as-root-mode'."
(:bind "SPC" #'+elfeed-scroll-up-command (:bind "SPC" #'+elfeed-scroll-up-command
"S-SPC" #'+elfeed-scroll-down-command "S-SPC" #'+elfeed-scroll-down-command
"&" #'+elfeed-show-browse-generic "&" #'+elfeed-show-browse-generic
"RET" #'shr-browse-url) "RET" #'shr-browse-url
"w" #'elfeed-show-yank
"y" nil)
(:hook #'reading-mode) (:hook #'reading-mode)
(:option +elfeed--update-repeat (* 60 30) ; 1/2 hour (:option +elfeed--update-repeat (* 60 30) ; 1/2 hour
+elfeed--update-first-time 60)) +elfeed--update-first-time 60))
@ -1744,9 +1754,10 @@ See also `crux-reopen-as-root-mode'."
(:option +mwim-passthrough-modes '(comint-mode (:option +mwim-passthrough-modes '(comint-mode
eshell-mode eshell-mode
vterm-mode vterm-mode
crossword-mode)) crossword-mode
(:global "C-a" #'+mwim-beginning-maybe geiser-repl-mode))
"C-e" #'+mwim-end-maybe)) (:global "C-a" #'mwim-beginning
"C-e" #'mwim-end))
(setup (:straight notmuch-bookmarks) (setup (:straight notmuch-bookmarks)
(:load-after notmuch) (:load-after notmuch)
@ -1780,12 +1791,16 @@ See also `crux-reopen-as-root-mode'."
(:hook-into org-mode)) (:hook-into org-mode))
(setup (:straight org-download) (setup (:straight org-download)
(:require)
(:option org-download-method 'attach (:option org-download-method 'attach
org-download-backend (cond ((executable-find "curl") 'curl) org-download-backend (cond ((executable-find "curl") 'curl)
((executable-find "wget") 'wget) ((executable-find "wget") 'wget)
(:else 'url-retrieve))) (:else 'url-retrieve)))
(add-hook 'dired-mode-hook 'org-download-enable)) (add-hook 'dired-mode-hook 'org-download-enable))
(setup (:straight org-mime)
(:option org-mime-export-ascii 'utf-8))
(setup (:straight org-mime) (setup (:straight org-mime)
(add-hook 'message-mode-hook (add-hook 'message-mode-hook
(defun org-mime-setup@message-mode () (defun org-mime-setup@message-mode ()
@ -1801,9 +1816,9 @@ See also `crux-reopen-as-root-mode'."
(setup (:straight (org-taskwise (setup (:straight (org-taskwise
:host github :host github
:repo "duckwork/org-taskwise.el")) :repo "duckwork/org-taskwise.el"))
(:load-after org) (with-eval-after-load 'org
(:bind-into org-mode (require 'org-taskwise)
"C-x n t" #'org-taskwise-narrow-to-task)) (define-key org-mode-map (kbd "C-x n t") #'org-taskwise-narrow-to-task)))
(setup (:straight org-visibility) (setup (:straight org-visibility)
(:require org-visibility) (:require org-visibility)
@ -1834,7 +1849,8 @@ See also `crux-reopen-as-root-mode'."
lisp-interaction-mode-hook lisp-interaction-mode-hook
lisp-mode-hook lisp-mode-hook
scheme-mode-hook scheme-mode-hook
geiser-mode-hook)) geiser-mode-hook
geiser-repl-mode-hook))
(add-hook hook #'enable-paredit-mode)) (add-hook hook #'enable-paredit-mode))
(:also-load eldoc) (:also-load eldoc)
(eldoc-add-command #'paredit-backward-delete #'paredit-close-round)) (eldoc-add-command #'paredit-backward-delete #'paredit-close-round))
@ -1916,6 +1932,7 @@ See also `crux-reopen-as-root-mode'."
+modeline-text-scale +modeline-text-scale
,(+modeline-concat ,(+modeline-concat
'(+modeline-god-mode '(+modeline-god-mode
+modeline-kmacro-indicator
+modeline-reading-mode +modeline-reading-mode
+modeline-narrowed) +modeline-narrowed)
",") ",")

View File

@ -60,6 +60,8 @@
(make-directory (file-name-directory script) :parents) (make-directory (file-name-directory script) :parents)
(with-temp-buffer (with-temp-buffer
(insert (insert
(let ((print-level nil)
(print-length nil))
(prin1-to-string ;; Print the following s-expression to a string (prin1-to-string ;; Print the following s-expression to a string
`(progn `(progn
;; Set up the environment ;; Set up the environment
@ -102,7 +104,7 @@
;; Garbage collect and save the database ;; Garbage collect and save the database
(elfeed-db-gc) (elfeed-db-gc)
(elfeed-db-save) (elfeed-db-save)
(princ (format ,update-message-format "done."))))) (princ (format ,update-message-format "done."))))))
(write-file script)) (write-file script))
(chmod script #o777) (chmod script #o777)
(message update-message-format "start") (message update-message-format "start")

View File

@ -60,15 +60,18 @@ Do this only if the buffer is not visiting a file."
enable-recursive-minibuffers t enable-recursive-minibuffers t
executable-prefix-env t executable-prefix-env t
fast-but-imprecise-scrolling t fast-but-imprecise-scrolling t
find-file-visit-truename t
file-name-shadow-properties '(invisible t intangible t) file-name-shadow-properties '(invisible t intangible t)
fill-column 80 fill-column 80
find-file-visit-truename t
frame-resize-pixelwise t frame-resize-pixelwise t
global-auto-revert-non-file-buffers t global-auto-revert-non-file-buffers t
global-mark-ring-max 100 global-mark-ring-max 100
hscroll-margin 1 hscroll-margin 1
hscroll-step 1 hscroll-step 1
imenu-auto-rescan t imenu-auto-rescan t
image-use-external-converter (or (executable-find "convert")
(executable-find "gm")
(executable-find "ffmpeg"))
indent-tabs-mode nil indent-tabs-mode nil
indicate-buffer-boundaries 'left indicate-buffer-boundaries 'left
indicate-empty-lines nil indicate-empty-lines nil
@ -104,7 +107,7 @@ Do this only if the buffer is not visiting a file."
save-interprogram-paste-before-kill t save-interprogram-paste-before-kill t
scroll-conservatively 101 scroll-conservatively 101
scroll-down-aggressively 0.01 scroll-down-aggressively 0.01
scroll-margin 1 scroll-margin 2
scroll-preserve-screen-position 1 scroll-preserve-screen-position 1
scroll-step 1 scroll-step 1
scroll-up-aggressively 0.01 scroll-up-aggressively 0.01
@ -148,6 +151,9 @@ Do this only if the buffer is not visiting a file."
;;; Encodings ;;; Encodings
;; Allegedly, this is the only one you need...
(set-language-environment "UTF-8")
;; But I still set all of these, for fun.
(setq-default locale-coding-system 'utf-8-unix (setq-default locale-coding-system 'utf-8-unix
coding-system-for-read 'utf-8-unix coding-system-for-read 'utf-8-unix
coding-system-for-write 'utf-8-unix coding-system-for-write 'utf-8-unix
@ -159,7 +165,6 @@ Do this only if the buffer is not visiting a file."
STRING)) STRING))
(set-charset-priority 'unicode) (set-charset-priority 'unicode)
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8-unix) (prefer-coding-system 'utf-8-unix)
(set-default-coding-systems 'utf-8-unix) (set-default-coding-systems 'utf-8-unix)
(set-terminal-coding-system 'utf-8-unix) (set-terminal-coding-system 'utf-8-unix)

View File

@ -58,14 +58,18 @@ prefix ARG is non-nil; then it just saves them."
(unless (buffer-file-name) (unless (buffer-file-name)
(user-error "Buffer not attached to file")) (user-error "Buffer not attached to file"))
(hack-dir-local-variables) (hack-dir-local-variables)
(when-let ((new-words (+ispell-append-removing-duplicates (let ((print-level nil)
(print-length nil))
(when-let ((new-words (cl-remove-if (lambda (el) (eq el '\.\.\.)) ; XXX: NO IDEA
; where this came from
(+ispell-append-removing-duplicates
:test #'string= :test #'string=
ispell-buffer-session-localwords ispell-buffer-session-localwords
(alist-get 'ispell-buffer-session-localwords (alist-get 'ispell-buffer-session-localwords
dir-local-variables-alist) dir-local-variables-alist)
(alist-get 'ispell-buffer-session-localwords (alist-get 'ispell-buffer-session-localwords
file-local-variables-alist) file-local-variables-alist)
(+ispell-buffer-local-words-list)))) (+ispell-buffer-local-words-list)))))
(save-excursion (save-excursion
(add-dir-local-variable (add-dir-local-variable
major-mode major-mode
@ -81,7 +85,7 @@ prefix ARG is non-nil; then it just saves them."
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(while (search-forward ispell-words-keyword nil t) (while (search-forward ispell-words-keyword nil t)
(delete-region (point-at-bol) (1+ (point-at-eol))))))) (delete-region (point-at-bol) (1+ (point-at-eol))))))))
;;;###autoload ;;;###autoload
(defun +ispell-move-buffer-words-to-dir-locals-hook () (defun +ispell-move-buffer-words-to-dir-locals-hook ()

View File

@ -21,6 +21,7 @@
(defun +kmacro-change-mode-line (&rest _) (defun +kmacro-change-mode-line (&rest _)
"Remap the mode-line face when recording a kmacro." "Remap the mode-line face when recording a kmacro."
(add-to-list 'face-remapping-alist '(mode-line . +kmacro-modeline))) (add-to-list 'face-remapping-alist '(mode-line . +kmacro-modeline)))
(defun +kmacro-restore-mode-line (&rest _) (defun +kmacro-restore-mode-line (&rest _)

View File

@ -296,7 +296,7 @@ See `line-number-mode', `column-number-mode', `file-percentage-mode'"
(interactive "e") (interactive "e")
(with-selected-window (with-selected-window
(posn-window (posn-window
(event-start ev)) (event-start e))
(god-local-mode -1) (god-local-mode -1)
(force-mode-line-update))))) (force-mode-line-update)))))
'mouse-face 'mode-line-highlight)))) 'mouse-face 'mode-line-highlight))))
@ -326,5 +326,26 @@ See `line-number-mode', `column-number-mode', `file-percentage-mode'"
map)) map))
'mouse-face 'mode-line-highlight)))) 'mouse-face 'mode-line-highlight))))
(defface +modeline-kmacro-indicator '((t :foreground "Firebrick"))
"Face for the kmacro indicator in the modeline.")
(defun +modeline-kmacro-indicator (&optional spacer)
"Display an indicator when recording a kmacro."
(when defining-kbd-macro
(concat (or spacer +modeline-default-spacer)
(propertize ""
'face '+modeline-kmacro-indicator
'help-echo (format (concat "Defining a macro\n"
"Current step: %d\n"
"mouse-1: Stop recording")
kmacro-counter)
'local-map (purecopy (simple-modeline-make-mouse-map
'mouse-1 (lambda (e)
(interactive "e")
(with-selected-window
(posn-window (event-start e))
(kmacro-end-macro nil)))))
'mouse-face 'mode-line-highlight))))
(provide '+modeline) (provide '+modeline)
;;; +modeline.el ends here ;;; +modeline.el ends here

View File

@ -550,6 +550,7 @@ language name.")
"Export region to HTML, and copy it to the clipboard. "Export region to HTML, and copy it to the clipboard.
Arguments ASYNC, SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST, Arguments ASYNC, SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST,
and POST-PROCESS are passed to `org-export-to-file'." and POST-PROCESS are passed to `org-export-to-file'."
(interactive) ; XXX: hould this be interactive?
(message "Exporting Org to HTML...") (message "Exporting Org to HTML...")
(let ((org-tmp-file "/tmp/org.html")) (let ((org-tmp-file "/tmp/org.html"))
(org-export-to-file 'html org-tmp-file (org-export-to-file 'html org-tmp-file
@ -567,8 +568,5 @@ and POST-PROCESS are passed to `org-export-to-file'."
(interactive) (interactive)
(+org-export-clip-to-html nil :subtree)) (+org-export-clip-to-html nil :subtree))
;;; Taskwise functions
;; TODO: break out into another library
(provide '+org) (provide '+org)
;;; +org.el ends here ;;; +org.el ends here

View File

@ -27,7 +27,8 @@
"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 tracking-mode (when (and tracking-mode
(not (bound-and-true-p org-clock-current-task)))
(cons (when (> (length tracking-mode-line-buffers) 0) (cons (when (> (length tracking-mode-line-buffers) 0)
'(track-mode-line-separator menu-item " " ignore)) '(track-mode-line-separator menu-item " " ignore))
(cl-loop for i from 0 below (length tracking-mode-line-buffers) (cl-loop for i from 0 below (length tracking-mode-line-buffers)
@ -63,7 +64,8 @@
(defun +tab-bar-org-clock () (defun +tab-bar-org-clock ()
"Display `org-mode-line-string' in the tab-bar." "Display `org-mode-line-string' in the tab-bar."
(when (org-clocking-p) (when (and (fboundp 'org-clocking-p)
(org-clocking-p))
;; org-mode-line-string ;; org-mode-line-string
`((org-clocking menu-item `((org-clocking menu-item
,org-mode-line-string ,org-mode-line-string

View File

@ -281,14 +281,20 @@ always nil; this function is mostly intended for use in init."
(defun chat-disconnect () (defun chat-disconnect ()
"Disconnect from all chats." "Disconnect from all chats."
(interactive) (interactive)
(+with-progress "Quitting circe..."
(ignore-errors (ignore-errors
(circe-command-GQUIT "☮ 🫀 🍞")) (circe-command-GQUIT "☮ 🫀 🍞")
(cancel-timer (irc-connection-get conn :flood-timer))))
(+with-progress "Quitting jabber..."
(ignore-errors (ignore-errors
(jabber-disconnect)) (jabber-disconnect)))
(+with-progress "Quitting-slack..."
(dolist (team +slack-teams) (dolist (team +slack-teams)
(ignore-errors (ignore-errors
(slack-team-disconnect team))) (slack-team-disconnect team)))
(ignore-errors (slack-ws-close)) (ignore-errors (slack-ws-close)))
(+with-progress "Killing buffers..."
(ignore-errors
(+mapc-some-buffers (lambda () "Remove the buffer from tracking and kill it unconditionally." (+mapc-some-buffers (lambda () "Remove the buffer from tracking and kill it unconditionally."
(let ((kill-buffer-query-functions nil)) (let ((kill-buffer-query-functions nil))
(tracking-remove-buffer (current-buffer)) (tracking-remove-buffer (current-buffer))
@ -298,7 +304,7 @@ always nil; this function is mostly intended for use in init."
'jabber-chat-mode 'jabber-chat-mode
'jabber-roster-mode 'jabber-roster-mode
'jabber-browse-mode 'jabber-browse-mode
'slack-mode)))) 'slack-mode))))))
;; I can never remember all the damn chat things I run, so this just does all of em. ;; I can never remember all the damn chat things I run, so this just does all of em.
(defun chat (&optional arg) (defun chat (&optional arg)
@ -306,7 +312,9 @@ always nil; this function is mostly intended for use in init."
With optional ARG, kill all chat-related buffers first." With optional ARG, kill all chat-related buffers first."
(interactive "P") (interactive "P")
(when arg (chat-disconnect)) (when arg (chat-disconnect))
(mapc #'call-interactively chat-functions)) (dolist-with-progress-reporter (fn chat-functions)
"Connecting to chat..."
(call-interactively fn)))
(defun +forward-paragraph (arg) (defun +forward-paragraph (arg)
"Move forward ARG (simple) paragraphs. "Move forward ARG (simple) paragraphs.
@ -353,5 +361,18 @@ SEPARATOR defaults to the newline (\\n)."
(with-current-buffer (find-file-noselect file) (with-current-buffer (find-file-noselect file)
(buffer-string))) (buffer-string)))
(defmacro +with-progress (pr-args &rest body)
"Perform BODY wrapped in a progress reporter.
PR-ARGS is the list of arguments to pass to
`make-progress-reporter'; it can be a single string for the
message, as well. If you want to use a formatted string, wrap
the `format' call in a list."
(declare (indent 1))
(let ((reporter (gensym))
(pr-args (if (listp pr-args) pr-args (list pr-args))))
`(let ((,reporter (make-progress-reporter ,@pr-args)))
(prog1 (progn ,@body)
(progress-reporter-done ,reporter)))))
(provide 'acdw) (provide 'acdw)
;;; acdw.el ends here ;;; acdw.el ends here

View File

@ -10,8 +10,8 @@
;; Other ideas: [[https://twitter.com/NPRougier/status/1488570192561160195][from Nic Rougier]] ;; Other ideas: [[https://twitter.com/NPRougier/status/1488570192561160195][from Nic Rougier]]
(add-function :after machine-after-load-theme (add-function :after machine-after-load-theme
(defun +bob-set-faces (&rest _) (defun +bob-set-faces (&rest _)
(let ((base-face "Monego") (let ((base-face "Roboto Mono")
(italic-face "Victor Mono") (italic-face nil)
;; (bold-face nil) ;; (bold-face nil)
(mono-face nil) (mono-face nil)
(var-face "Lato") (var-face "Lato")
@ -22,16 +22,17 @@
:height ,base-size) :height ,base-size)
;; (bold :family ,(or bold-face base-face) ;; (bold :family ,(or bold-face base-face)
;; :weight bold) ;; :weight bold)
(italic :family ,(or italic-face base-face) ;; (italic :family ,(or italic-face base-face)
:weight medium ;; :weight medium
:slant italic ;; :slant italic
:height ,base-size) ;; :height ,base-size)
(fixed-pitch :family ,(or mono-face base-face) (fixed-pitch :family ,(or mono-face base-face)
:weight regular :weight regular
:height ,base-size) :height ,base-size)
(variable-pitch :family ,(or var-face base-face) (variable-pitch :family ,(or var-face base-face)
:height 1.2) :height 1.2)
(org-italic :family ,(or var-face base-face) (org-italic :family ,(or var-face base-face)
:slant italic)))))) :slant italic))))
))
;;; bob.el ends here ;;; bob.el ends here