From 29c287a8c31bebe9dd40b499415511c96a1ef6fa Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 30 Mar 2022 18:14:56 -0500 Subject: I waited way too long to make this commit --- init.el | 157 ++++++++++++++++++++++++++++++++------------------- lisp/+consult.el | 2 +- lisp/+elfeed.el | 8 +++ lisp/+modeline.el | 13 +++-- lisp/acdw.el | 12 ++++ lisp/user-save.el | 18 +++++- machines/bob.el | 34 +++++------ snippets/org-mode/sc | 2 +- 8 files changed, 164 insertions(+), 82 deletions(-) diff --git a/init.el b/init.el index 5e52215..e032819 100644 --- a/init.el +++ b/init.el @@ -117,12 +117,18 @@ (add-hook 'user-save-hook #'+clean-empty-lines) (user-save-global-mode +1)) +(setup (:require winner) + (winner-mode +1)) + (setup +key (+ensure-after-init #'+key-global-mode)) (setup abbrev (:option abbrev-file-name (sync/ "abbrev.el") save-abbrevs 'silent) +(with-eval-after-load 'user-save + (:with-mode edit-abbrevs-mode + (:hook #'turn-off-user-save-mode))) (:hook-into text-mode circe-chat-mode)) @@ -177,42 +183,41 @@ (add-to-list '+browse-url-secondary-browser-regexps (replace-regexp-in-string "\\." "\\\\." domain))) ;; Set up URL handlers. - (with-eval-after-load 'org-contacts - (require 'chd) - (+browse-url-set-handlers - (list - (cons (rx ; images - "." (or "jpeg" "jpg" "png" "bmp") eos) - (lambda (&rest args) - (apply - (cond ((executable-find "mpv") #'+browse-image-with-mpv) - (t #'eww-browse-url)) - args))) - (cons (rx (or ;; videos - "youtube.com" "youtu.be" "invidious" "yewtu.be" - (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos) - ;; music - "soundcloud.com" "bandcamp.com" - (seq "." (or "ogg" "mp3" "opus" "m4a") eos))) - (lambda (&rest args) - (apply (if (executable-find "mpv") - #'+browse-url-with-mpv - browse-url-secondary-browser-function) - args))) - (cons chd/url-regexps #'browse-url-chrome) - (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites - (lambda (&rest args) - (apply browse-url-secondary-browser-function args))) - (cons "xkcd\\.com" - (lambda (&rest args) - (apply (if (fboundp #'xkcd-get) - (progn (require '+xkcd) - #'+xkcd-get-from-url) - +browse-url-browser-function) - args))) - (cons "." ; everything else - (lambda (&rest args) - (apply +browse-url-browser-function args)))))) + (require 'chd) + (+browse-url-set-handlers + (list + (cons (rx ; images + "." (or "jpeg" "jpg" "png" "bmp") eos) + (lambda (&rest args) + (apply + (cond ((executable-find "mpv") #'+browse-image-with-mpv) + (t #'eww-browse-url)) + args))) + (cons (rx (or ;; videos + "youtube.com" "youtu.be" "invidious" "yewtu.be" + (seq "." (or "mp4" "gif" "mov" "MOV" "webm") eos) + ;; music + "soundcloud.com" "bandcamp.com" + (seq "." (or "ogg" "mp3" "opus" "m4a") eos))) + (lambda (&rest args) + (apply (if (executable-find "mpv") + #'+browse-url-with-mpv + browse-url-secondary-browser-function) + args))) + (cons chd/url-regexps #'browse-url-chrome) + (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites + (lambda (&rest args) + (apply browse-url-secondary-browser-function args))) + (cons "xkcd\\.com" + (lambda (&rest args) + (apply (if (fboundp #'xkcd-get) + (progn (require '+xkcd) + #'+xkcd-get-from-url) + +browse-url-browser-function) + args))) + (cons "." ; everything else + (lambda (&rest args) + (apply +browse-url-browser-function args))))) ;; Transform URLs before passing to `browse-url' (:option +browse-url-transformations `((,(rx (or "youtube.com" "youtu.be")) @@ -472,7 +477,8 @@ (:option notmuch-init-file (notmuch/ "notmuch-init.el" t) notmuch-address-save-filename (notmuch/ "addresses" t) notmuch-address-use-company (featurep 'company) - notmuch-search-oldest-first nil) + notmuch-search-oldest-first nil + notmuch-archive-tags '("-inbox" "-unread")) ;; Composing mail (:option message-kill-buffer-on-exit t message-auto-save-directory "~/var/mail/drafts") @@ -554,6 +560,9 @@ ("+" . "-")) org-log-done 'time org-log-into-drawer t + org-num-skip-commented t + org-num-skip-unnumbered t + org-num-skip-footnotes t org-outline-path-complete-in-steps nil org-pretty-entities t org-pretty-entities-include-sub-superscripts nil @@ -573,6 +582,7 @@ (sequence "|" "CANCELED(k@)") (sequence "MEETING(m)") (sequence "ASSIGNED(a@/!)" "REVIEW(r)" "|" "DONE(d!)")) + org-use-speed-commands t org-emphasis-alist '(("*" org-bold) ("/" org-italic) ("_" org-underline) @@ -612,9 +622,9 @@ ;; complains about "Invalid face reference: t" in org-mode buffers, because ;; `compose-region' returns t. ("^ *\\([-]\\) " - (0 (progn (compose-region (match-beginning 1) (match-end 1) "∙") 'default))) + (0 (progn (compose-region (match-beginning 1) (match-end 1) "›") 'default))) ("^ *\\([+]\\) " - (0 (progn (compose-region (match-beginning 1) (match-end 1) "◦") 'default))))) + (0 (progn (compose-region (match-beginning 1) (match-end 1) "»") 'default))))) (with-eval-after-load 'form-feed ;; Horizontal lines (font-lock-add-keywords @@ -715,6 +725,13 @@ (with-eval-after-load 'user-save (advice-add 'org-export-dispatch :before 'user-save-run-hooks))) +(setup org-id + (:load-after org) + ;; https://helpdeskheadesk.net/2022-03-13/ + (:option org-id-method 'ts + org-attach-id-to-path-function-list '(org-attach-id-ts-folder-format + org-attach-id-uuid-folder-format))) + (setup password-cache (:option password-cache t password-cache-expiry (* 60 60))) @@ -746,8 +763,9 @@ tab-bar-tab-name-ellipsis truncate-string-ellipsis tab-bar-show t tab-bar-close-button-show t - +tab-bar-menu-bar-icon " ☰ " - tab-bar-close-button (propertize " ¬ " + tab-bar-new-button-show nil + +tab-bar-menu-bar-icon " ; " + tab-bar-close-button (propertize "(x)" 'display t 'close-tab t) tab-bar-new-button (propertize "+ " 'display t)) @@ -755,7 +773,7 @@ (:option display-time-format "%H:%M" display-time-mail-file :disable display-time-load-average-threshold 50) - (:option tab-bar-format '(+tab-bar-format-menu-bar + (:option tab-bar-format '(;;+tab-bar-format-menu-bar tab-bar-format-history tab-bar-format-tabs tab-bar-separator @@ -821,7 +839,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type) (setq input (orderless-pattern-compiler input)) (cons input (lambda (str) (orderless--highlight input str))))) - (with-eval-after-load 'affe + (+with-eval-after-loads (affe vertico-multiform) (setf (alist-get 'affe-grep vertico-multiform-commands) '(buffer) (alist-get 'affe-find vertico-multiform-commands) '(buffer)) (:+key "M-s g" #'affe-grep @@ -926,7 +944,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." '(cape-file cape-dabbrev cape-keyword - cape-abbrev + ;;cape-abbrev cape-ispell ;;cape-dict )) @@ -1100,6 +1118,11 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." (:with-mode tracking-mode (:option tracking-position 'before-modes) + (:bind "C-c C-SPC" (lambda () (interactive) + (if (and (fboundp 'org-clocking-p) + (org-clocking-p)) + (message "Bro, get back to work!") + (call-interactively #'tracking-next-buffer)))) (add-to-list 'mode-line-misc-info '(tracking-mode tracking-mode-line-buffers))) @@ -1122,7 +1145,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." (setup (:straight clhs)) (setup (:straight consult) - (:also-load +consult) + (:require consult +consult) ;; from Consult wiki (:option register-preview-delay 0 register-preview-function #'consult-register-format @@ -1352,7 +1375,8 @@ See also `crux-reopen-as-root-mode'." (:with-mode elfeed-search-mode (:bind "&" #'+elfeed-search-browse-generic "w" #'elfeed-search-yank - "y" nil) + "y" nil + "a" #'+elfeed-show-mark-read-and-advance) (:hook #'hl-line-mode) ;; https://old.reddit.com/r/emacs/comments/rlli0u/whats_your_favorite_defadvice/hphfh4e/ (advice-add #'elfeed-search-update--force :after #'elfeed-db-save) @@ -1367,7 +1391,8 @@ See also `crux-reopen-as-root-mode'." (:hook #'reading-mode) (:option +elfeed--update-repeat (* 60 30) ; 1/2 hour +elfeed--update-first-time 60)) - (+elfeed-update-async-mode +1)) + (+elfeed-update-async-mode -1) ; It really messes with stuff for work + ) (setup (:straight elfeed-org) (:also-load +org-capture) @@ -1735,9 +1760,9 @@ See also `crux-reopen-as-root-mode'." (require 'modus-themes (.etc "straight/build/modus-themes/modus-themes")) (:also-load dawn) (:option modus-themes-mixed-fonts t - modus-themes-bold-constructs t + modus-themes-bold-constructs nil modus-themes-italic-constructs t - modus-themes-headings '((t . (background)))) + modus-themes-headings '((t . (background regular rainbow)))) (dotimes (facen-1 8) (let ((facen (1+ facen-1))) (custom-set-faces @@ -1746,6 +1771,8 @@ See also `crux-reopen-as-root-mode'." (,(intern (format "modus-themes-heading-%s" facen)) fixed-pitch)) :now))))) + (:face modus-themes-tab-active ((t :bold nil)) + modus-themes-tab-inactive ((t :italic t))) (dawn-schedule #'modus-themes-load-operandi #'modus-themes-load-vivendi)) @@ -1862,6 +1889,9 @@ See also `crux-reopen-as-root-mode'." lisp-interaction-mode scheme-mode)) +(setup (:straight pdf-tools) + (pdf-tools-install)) + ;; (setup (:straight-when pdf-tools ;; ;; Ensure we can build `pdf-tools' ;; (or (executable-find "gcc") @@ -1905,11 +1935,17 @@ See also `crux-reopen-as-root-mode'." :host github :repo "gexplorer/simple-modeline" :fork (:host github :repo "duckwork/simple-modeline"))) (:require +modeline) - (:option +modeline-modified-icon-alist '((ephemeral . "🥞") - (special . "🥐") - (readonly . "🦞") - (modified . "🥪") - (t . "🍞")) + (:option +modeline-modified-icon-alist '((ephemeral . "~") + (special . "*") + (readonly . "=") + (modified . "+") + (t . "-")) + ;; '((ephemeral . "🥞") + ;; (special . "🥐") + ;; (readonly . "🦞") + ;; (modified . "🥪") + ;; (t . "🍞")) + +modeline-minions-icon ";" simple-modeline-segments `(( ; left @@ -1950,10 +1986,14 @@ See also `crux-reopen-as-root-mode'." slack-buffer-emojify t slack-buffer-create-on-notify t slack-enable-wysiwyg t - slack-file-dir "~/var/download/" + slack-file-dir (xdg-user-dir "DOWNLOAD") slack-display-team-name nil) (with-eval-after-load '+slack - (+slack-register-teams))) + (+slack-register-teams)) + (with-eval-after-load 'alert + ;; Don't notify for Slack messages + (alert-add-rule :category "slack" + :style 'ignore))) (setup (:straight-when sly (defvar +lisp-bin (executable-find "sbcl"))) @@ -2055,6 +2095,9 @@ See also `crux-reopen-as-root-mode'." (setup (:straight unfill)) +(setup (:straight valign) + (:hook-into org-mode)) + (setup (:straight valign) (:quit "Doesn't work with narrowed tables.") (:option valign-fancy-bar t) (:hook-into org-mode @@ -2065,7 +2108,7 @@ See also `crux-reopen-as-root-mode'." :repo "minad/vertico" :files ("*" "extensions/*" (:exclude ".git")))) - (:also-load +vertico) + (:require vertico +vertico) (:option resize-mini-windows 'grow-only vertico-count-format nil vertico-cycle t) diff --git a/lisp/+consult.el b/lisp/+consult.el index 0f5bf45..dc06ad5 100644 --- a/lisp/+consult.el +++ b/lisp/+consult.el @@ -12,7 +12,7 @@ ;;; Cribbed functions ;; https://github.com/minad/consult/wiki -(defun consult--orderless-regexp-compiler (input type) +(defun consult--orderless-regexp-compiler (input type &rest _) (setq input (orderless-pattern-compiler input)) (cons (mapcar (lambda (r) (consult--convert-regexp r type)) input) diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index 8f7f17a..7f9e193 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el @@ -31,6 +31,14 @@ (interactive) (elfeed-show-visit t)) +(defun +elfeed-show-mark-read-and-advance () + "Mark an item as read and advance to the next item. +If multiple items are selected, don't advance." + (interactive) + (call-interactively #'elfeed-search-untag-all-unread) + (unless (region-active-p) + (call-interactively #'next-line))) + ;;; Fetch feeds async ;; https://github.com/skeeto/elfeed/issues/367 diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 7bef5c6..3cc8806 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -93,12 +93,13 @@ This function makes a lambda, so you can throw it straight into (defun +modeline-major-mode (&optional spacer) "Display the current `major-mode'." (concat (or spacer +modeline-default-spacer) - (propertize (+string-truncate (format-mode-line mode-name) 16) - 'face 'bold - 'keymap mode-line-major-mode-keymap - 'help-echo (concat (format-mode-line mode-name) - " mode\nmouse-1: show menu.") - 'mouse-face 'mode-line-highlight))) + (propertize ;; (+string-truncate (format-mode-line mode-name) 16) + (format-mode-line mode-name) + 'face 'font-lock-keyword-face + 'keymap mode-line-major-mode-keymap + 'help-echo (concat (format-mode-line mode-name) + " mode\nmouse-1: show menu.") + 'mouse-face 'mode-line-highlight))) (defcustom +modeline-modified-icon-alist '((ephemeral . "*") (readonly . "=") diff --git a/lisp/acdw.el b/lisp/acdw.el index de2b8e7..764a246 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -374,5 +374,17 @@ the `format' call in a list." (prog1 (progn ,@body) (progress-reporter-done ,reporter))))) +(defmacro +with-eval-after-loads (features &rest body) + "Execute BODY after all FEATURES are loaded." + (declare (indent 1) (debug (form def-body))) + (unless (listp features) + (setq features (list features))) + (if (null features) + (macroexp-progn body) + (let* ((this (car features)) + (rest (cdr features))) + `(with-eval-after-load ',this + (+with-eval-after-loads ,rest ,@body))))) + (provide 'acdw) ;;; acdw.el ends here diff --git a/lisp/user-save.el b/lisp/user-save.el index 8e01af1..33b6f4c 100644 --- a/lisp/user-save.el +++ b/lisp/user-save.el @@ -8,6 +8,8 @@ ;;; Code: +(require 'cl-lib) + (defgroup user-save nil "Group for `user-save-mode' customizations." :group 'emacs @@ -19,11 +21,16 @@ This option is only useful is `user-save-mode' is active when Emacs is killed." :type 'boolean) +(defcustom user-save-inhibit '(special-mode) + "List of modes to inhibit `user-save-mode' from activation in." + :type '(repeat symbol)) + (defvar user-save-hook nil "Hook to run when the user, not Emacs, saves the buffer.") (defvar user-save-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-x C-s") #'user-save-buffer) + (define-key map (kbd "C-x s") #'user-save-some-buffers) map) "Keymap for `user-save-mode'. This map shadows the default map for `save-buffer'.") @@ -81,7 +88,16 @@ whether the buffer needs to be saved." (user-save-mode -1)) ;;;###autoload -(define-globalized-minor-mode user-save-global-mode user-save-mode user-save-mode +(defun user-save-mode-in-some-buffers () + "Enable `user-save-mode', but only in some buffers. +The mode will not be enabled in buffers derived from modes in +`user-save-inhibit', or in the minibuffer." + (unless (or (cl-some #'derived-mode-p user-save-inhibit) + (minibufferp)) + (user-save-mode +1))) + +;;;###autoload +(define-globalized-minor-mode user-save-global-mode user-save-mode user-save-mode-in-some-buffers (if user-save-global-mode (when user-save-hook-into-kill-emacs (add-hook 'kill-emacs-hook #'user-save-some-buffers)) diff --git a/machines/bob.el b/machines/bob.el index 3455c44..77034d2 100644 --- a/machines/bob.el +++ b/machines/bob.el @@ -10,29 +10,31 @@ ;; Other ideas: [[https://twitter.com/NPRougier/status/1488570192561160195][from Nic Rougier]] (add-function :after machine-after-load-theme (defun +bob-set-faces (&rest _) - (let ((base-face "Roboto Mono") + (let ((base-face "IBM Plex Mono") + (base-size 105) (italic-face nil) ;; (bold-face nil) (mono-face nil) - (var-face "Lato") - (base-size 110)) + (var-face "IBM Plex Serif") + (var-size 1.0)) (+set-faces - `((default :family ,base-face - :weight regular - :height ,base-size) + `((default + :family ,base-face + :height ,base-size + :weight normal) ;; (bold :family ,(or bold-face base-face) ;; :weight bold) - ;; (italic :family ,(or italic-face base-face) - ;; :weight medium - ;; :slant italic - ;; :height ,base-size) + (italic :family ,(or italic-face base-face) + :weight normal + :slant italic) (fixed-pitch :family ,(or mono-face base-face) - :weight regular :height ,base-size) - (variable-pitch :family ,(or var-face base-face) - :height 1.2) - (org-italic :family ,(or var-face base-face) - :slant italic)))) + (variable-pitch + :family ,(or var-face base-face) + :height ,var-size) + (org-italic + :family ,(or var-face base-face) + :slant italic)))) )) -;;; bob.el ends here +;; bob.el ends here diff --git a/snippets/org-mode/sc b/snippets/org-mode/sc index 977fe22..afc7faf 100644 --- a/snippets/org-mode/sc +++ b/snippets/org-mode/sc @@ -1,4 +1,4 @@ # key: sc # name: sc # -- -[sc="${1: $(yas-choose-value '("total-recovery" "br-location-page" "_locationnameslisted" "organizations-helped" "other-results" "truck-accident-results" "car-wreck-results" "personal-injury-results" "number-locations" "experience" "employees" "mon-number" "mon-address" "lc-number" "lc-address" "ham-number" "ham-address" "zac-number" "zac-address" "liv-number" "liv-address" "asc-number" "asc-address" "shrev-number" "shrev-address" "alx-address" "alx-number" "laf-number" "laf-address" "toll-free" "br-number" "br-address" "gmia"))}"][/sc] $0 \ No newline at end of file +[sc name="${1: $(yas-choose-value '("total-recovery" "br-location-page" "_locationnameslisted" "organizations-helped" "other-results" "truck-accident-results" "car-wreck-results" "personal-injury-results" "number-locations" "experience" "employees" "mon-number" "mon-address" "lc-number" "lc-address" "ham-number" "ham-address" "zac-number" "zac-address" "liv-number" "liv-address" "asc-number" "asc-address" "shrev-number" "shrev-address" "alx-address" "alx-number" "laf-number" "laf-address" "toll-free" "br-number" "br-address" "gmia"))}"][/sc] $0 \ No newline at end of file -- cgit 1.4.1-21-gabe81