diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | init.el | 64 | ||||
-rw-r--r-- | lisp/+browse-url.el | 4 | ||||
-rw-r--r-- | lisp/+chicken.el | 19 | ||||
-rw-r--r-- | lisp/+elfeed.el | 17 | ||||
-rw-r--r-- | lisp/+eshell.el | 16 | ||||
-rw-r--r-- | lisp/+org.el | 14 | ||||
-rw-r--r-- | lisp/+tab-bar.el | 2 |
8 files changed, 120 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore index 71b07a9..4c2cdcd 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -18,3 +18,6 @@ transient/ | |||
18 | var/ | 18 | var/ |
19 | eshell/* | 19 | eshell/* |
20 | !eshell/aliases | 20 | !eshell/aliases |
21 | |||
22 | # put random stuff in here | ||
23 | scratch.el | ||
diff --git a/init.el b/init.el index 9c44e8b..4ea6f90 100644 --- a/init.el +++ b/init.el | |||
@@ -39,6 +39,7 @@ | |||
39 | "C-x o" (lambda () (interactive) (switch-to-buffer nil)) | 39 | "C-x o" (lambda () (interactive) (switch-to-buffer nil)) |
40 | "C-x C-o" #'+open-paragraph | 40 | "C-x C-o" #'+open-paragraph |
41 | "C-w" #'+kill-word-backward-or-region | 41 | "C-w" #'+kill-word-backward-or-region |
42 | "C-x C-m" #'execute-extended-command ; original: coding systems | ||
42 | ;; "C-x C-1" #'delete-other-windows | 43 | ;; "C-x C-1" #'delete-other-windows |
43 | ;; "C-x 2" #'+split-window-below-then | 44 | ;; "C-x 2" #'+split-window-below-then |
44 | ;; "C-x C-2" #'+split-window-below-then | 45 | ;; "C-x C-2" #'+split-window-below-then |
@@ -342,6 +343,8 @@ | |||
342 | eshell-prompt-regexp (rx bol (* (not (any ?# ?$ ?\n))) | 343 | eshell-prompt-regexp (rx bol (* (not (any ?# ?$ ?\n))) |
343 | " " (any ?# ?$) | 344 | " " (any ?# ?$) |
344 | (* " "))) | 345 | (* " "))) |
346 | (:+leader "s" #'+eshell-here | ||
347 | "C-s" #'+eshell-here) | ||
345 | (with-eval-after-load 'mwim | 348 | (with-eval-after-load 'mwim |
346 | (setf (alist-get 'eshell-mode mwim-beginning-of-line-function) | 349 | (setf (alist-get 'eshell-mode mwim-beginning-of-line-function) |
347 | #'eshell-bol)) | 350 | #'eshell-bol)) |
@@ -350,19 +353,19 @@ | |||
350 | (dolist (mode '((hungry-delete-mode . -1))) | 353 | (dolist (mode '((hungry-delete-mode . -1))) |
351 | (funcall (car mode) (cdr mode))) | 354 | (funcall (car mode) (cdr mode))) |
352 | ;; Set local settings | 355 | ;; Set local settings |
353 | (dolist (setting (list (cons 'outline-regexp eshell-prompt-regexp) | 356 | (dolist (setting `((outline-regexp . ,eshell-prompt-regexp) |
354 | (cons 'page-delimiter eshell-prompt-regexp) | 357 | (page-delimiter . ,eshell-prompt-regexp) |
355 | (cons 'imenu-generic-expression | 358 | (imenu-generic-expression "Prompt" |
356 | (list "Prompt" | 359 | ,(concat eshell-prompt-regexp |
357 | (concat eshell-prompt-regexp | 360 | "\\(.*\\)") |
358 | "\\(.*\\)") | 361 | 1) |
359 | 1)) | 362 | (truncate-lines . t) |
360 | (cons 'truncate-lines t))) | 363 | (scroll-margin . 0))) |
361 | (set (make-local-variable (car setting)) (cdr setting))) | 364 | (set (make-local-variable (car setting)) (cdr setting))) |
362 | ;; Bind keys | 365 | ;; Bind keys |
363 | (dolist (binding '(("C-d" . +eshell-quit-or-delete-char))) | 366 | (dolist (binding '(("C-d" . +eshell-quit-or-delete-char))) |
364 | (define-key eshell-mode-map | 367 | (define-key eshell-mode-map |
365 | (kbd (car binding)) (cdr binding))) | 368 | (kbd (car binding)) (cdr binding))) |
366 | ;; Environment variables | 369 | ;; Environment variables |
367 | (dolist (environment '(("PAGER" . "cat"))) | 370 | (dolist (environment '(("PAGER" . "cat"))) |
368 | (setenv (car environment) (cdr environment))))) | 371 | (setenv (car environment) (cdr environment))))) |
@@ -425,6 +428,8 @@ | |||
425 | 428 | ||
426 | (setup info | 429 | (setup info |
427 | (:also-load +Info) | 430 | (:also-load +Info) |
431 | (dolist (dir (split-string (getenv "INFOPATH") ":" t)) | ||
432 | (add-to-list 'Info-additional-directory-list dir)) | ||
428 | (:with-mode Info-mode ; -_- | 433 | (:with-mode Info-mode ; -_- |
429 | (:hook #'reading-mode) | 434 | (:hook #'reading-mode) |
430 | (:bind "c" #'+Info-copy-current-node-name | 435 | (:bind "c" #'+Info-copy-current-node-name |
@@ -836,11 +841,11 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
836 | (and (executable-find "find") | 841 | (and (executable-find "find") |
837 | (executable-find "grep")))) | 842 | (executable-find "grep")))) |
838 | (:load-after consult orderless vertico) | 843 | (:load-after consult orderless vertico) |
839 | (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type) | 844 | (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _) |
840 | (setq input (orderless-pattern-compiler input)) | 845 | (setq input (orderless-pattern-compiler input)) |
841 | (cons input (lambda (str) (orderless--highlight input str))))) | 846 | (cons input (lambda (str) (orderless--highlight input str))))) |
842 | (+with-eval-after-loads (affe vertico-multiform) | 847 | (+with-eval-after-loads (affe vertico-multiform) |
843 | (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type) | 848 | (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _) |
844 | (setq input (orderless-pattern-compiler input)) | 849 | (setq input (orderless-pattern-compiler input)) |
845 | (cons input (lambda (str) (orderless--highlight input str))))) | 850 | (cons input (lambda (str) (orderless--highlight input str))))) |
846 | (setf (alist-get 'affe-grep vertico-multiform-commands) '(buffer) | 851 | (setf (alist-get 'affe-grep vertico-multiform-commands) '(buffer) |
@@ -1285,7 +1290,6 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." | |||
1285 | "M-w" #'+crux-kill-ring-save | 1290 | "M-w" #'+crux-kill-ring-save |
1286 | "C-k" #'crux-kill-and-join-forward | 1291 | "C-k" #'crux-kill-and-join-forward |
1287 | "C-c d" #'+crux-insert-date-or-time) | 1292 | "C-c d" #'+crux-insert-date-or-time) |
1288 | (:+leader "s" #'crux-visit-shell-buffer) | ||
1289 | (crux-with-region-or-buffer indent-region) | 1293 | (crux-with-region-or-buffer indent-region) |
1290 | 1294 | ||
1291 | (el-patch-feature crux) | 1295 | (el-patch-feature crux) |
@@ -1394,8 +1398,17 @@ See also `crux-reopen-as-root-mode'." | |||
1394 | (:hook #'reading-mode) | 1398 | (:hook #'reading-mode) |
1395 | (:option +elfeed--update-repeat (* 60 30) ; 1/2 hour | 1399 | (:option +elfeed--update-repeat (* 60 30) ; 1/2 hour |
1396 | +elfeed--update-first-time 60)) | 1400 | +elfeed--update-first-time 60)) |
1397 | (+elfeed-update-async-mode -1) ; It really messes with stuff for work | 1401 | (+elfeed-update-async-mode +1) |
1398 | ) | 1402 | (add-hook '+elfeed-update-proceed-hook (defun non-work-hours? () |
1403 | "Return nil if during work hours, t otherwise." | ||
1404 | (let* ((now (current-time)) | ||
1405 | (now* (decode-time now)) | ||
1406 | (work-start* (append '(0 0 8) (cdddr now*))) ; 8:00 AM | ||
1407 | (work-end* (append '(0 0 18) (cdddr now*))) ; 6:00 PM | ||
1408 | (work-start (encode-time work-start*)) | ||
1409 | (work-end (encode-time work-end*))) | ||
1410 | (or (time-less-p now work-start) | ||
1411 | (time-less-p work-end now)))))) | ||
1399 | 1412 | ||
1400 | (setup (:straight elfeed-org) | 1413 | (setup (:straight elfeed-org) |
1401 | (:also-load +org-capture) | 1414 | (:also-load +org-capture) |
@@ -1530,6 +1543,7 @@ See also `crux-reopen-as-root-mode'." | |||
1530 | geiser-chicken | 1543 | geiser-chicken |
1531 | macrostep-geiser | 1544 | macrostep-geiser |
1532 | scheme-complete) | 1545 | scheme-complete) |
1546 | (:also-load +chicken) | ||
1533 | (setf (alist-get "\\.scm\\'" auto-mode-alist nil nil #'string=) | 1547 | (setf (alist-get "\\.scm\\'" auto-mode-alist nil nil #'string=) |
1534 | 'scheme-mode)) | 1548 | 'scheme-mode)) |
1535 | 1549 | ||
@@ -1776,6 +1790,28 @@ See also `crux-reopen-as-root-mode'." | |||
1776 | :now))))) | 1790 | :now))))) |
1777 | (:face modus-themes-tab-active ((t :bold nil)) | 1791 | (:face modus-themes-tab-active ((t :bold nil)) |
1778 | modus-themes-tab-inactive ((t :italic t))) | 1792 | modus-themes-tab-inactive ((t :italic t))) |
1793 | |||
1794 | (add-hook 'modus-themes-after-load-theme-hook | ||
1795 | (defun +modus-themes-mostly-monochrome () | ||
1796 | "Set up mdous-themes to be mostly monochrome." | ||
1797 | (modus-themes-with-colors | ||
1798 | (custom-set-faces | ||
1799 | `(font-lock-builtin-face ((,class :inherit modus-themes-bold :foreground unspecified))) | ||
1800 | `(font-lock-comment-delimiter-face ((,class :inherit font-lock-comment-face))) | ||
1801 | `(font-lock-comment-face ((,class :inherit modus-themes-slant :foreground ,fg-docstring))) | ||
1802 | `(font-lock-constant-face ((,class :foreground unspecified))) | ||
1803 | `(font-lock-doc-face ((,class :inherit modus-themes-slant :foreground ,fg-docstring))) | ||
1804 | `(font-lock-function-name-face ((,class :foreground unspecified))) | ||
1805 | `(font-lock-keyword-face ((,class :inherit modus-themes-bold :foreground unspecified))) | ||
1806 | `(font-lock-negation-char-face ((,class :inherit modus-themes-bold :foreground unspecified))) | ||
1807 | `(font-lock-preprocessor-face ((,class :foreground unspecified))) | ||
1808 | `(font-lock-regexp-grouping-backslash ((,class :foreground ,fg-escape-char-backslash))) | ||
1809 | `(font-lock-regexp-grouping-construct ((,class :foreground ,fg-escape-char-construct))) | ||
1810 | `(font-lock-string-face ((,class :inherit modus-themes-slant :foreground unspecified))) | ||
1811 | `(font-lock-type-face ((,class :inherit modus-themes-bold :foreground unspecified))) | ||
1812 | `(font-lock-variable-name-face ((,class :foreground unspecified))) | ||
1813 | `(font-lock-warning-face ((,class :inherit modus-themes-bold :foreground ,red-nuanced-fg))))))) | ||
1814 | |||
1779 | (dawn-schedule #'modus-themes-load-operandi | 1815 | (dawn-schedule #'modus-themes-load-operandi |
1780 | #'modus-themes-load-vivendi)) | 1816 | #'modus-themes-load-vivendi)) |
1781 | 1817 | ||
diff --git a/lisp/+browse-url.el b/lisp/+browse-url.el index 68fb7b0..dbbfef2 100644 --- a/lisp/+browse-url.el +++ b/lisp/+browse-url.el | |||
@@ -63,7 +63,9 @@ If FALLBACK is non-nil, it's a function to fallback on if the | |||
63 | (funcall fallback url new-window)))))) | 63 | (funcall fallback url new-window)))))) |
64 | 64 | ||
65 | ;; Reference implementation: mpv | 65 | ;; Reference implementation: mpv |
66 | (+browse-url-make-external-viewer-handler "mpv" nil "Video URL: ") | 66 | (+browse-url-make-external-viewer-handler "mpv" '("--cache-pause-wait=30" |
67 | "--cache-pause-initial=yes") | ||
68 | "Video URL: ") | ||
67 | ;; And feh too | 69 | ;; And feh too |
68 | (+browse-url-make-external-viewer-handler "feh" '("--auto-zoom" | 70 | (+browse-url-make-external-viewer-handler "feh" '("--auto-zoom" |
69 | "--geometry" "800x600")) | 71 | "--geometry" "800x600")) |
diff --git a/lisp/+chicken.el b/lisp/+chicken.el new file mode 100644 index 0000000..ef5f616 --- /dev/null +++ b/lisp/+chicken.el | |||
@@ -0,0 +1,19 @@ | |||
1 | ;;; +chicken.el --- Chicken Scheme additions -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; Commentary: | ||
4 | |||
5 | ;;; Code: | ||
6 | |||
7 | ;; Reload [[https://wiki.call-cc.org/eggref/5/awful][awful]] with a keybinding | ||
8 | |||
9 | (defun +chicken-awful-reload () | ||
10 | "Reload awful by visiting /reload." | ||
11 | (interactive) | ||
12 | (save-buffer) | ||
13 | (condition-case e | ||
14 | (url-retrieve-synchronously "http://localhost:8080/reload") | ||
15 | (file-error (message "Couldn't ping awful's server. Is it running?")) | ||
16 | (t (message "Some awful error occurred!")))) | ||
17 | |||
18 | (provide '+chicken) | ||
19 | ;;; +chicken.el ends here | ||
diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index 7f9e193..c0b74f0 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el | |||
@@ -133,6 +133,19 @@ If multiple items are selected, don't advance." | |||
133 | (defvar +elfeed--update-first-time 6 "How long to wait for the first time.") | 133 | (defvar +elfeed--update-first-time 6 "How long to wait for the first time.") |
134 | (defvar +elfeed--update-repeat (* 60 15) "How long between updates.") | 134 | (defvar +elfeed--update-repeat (* 60 15) "How long between updates.") |
135 | 135 | ||
136 | (defcustom +elfeed-update-proceed-hook nil | ||
137 | "Predicates to query before running `+elfeed-update-command'. | ||
138 | Each hook is passed no arguments." | ||
139 | :type 'hook) | ||
140 | |||
141 | (defun +elfeed-update-command-wrapper () | ||
142 | "Run `+elfeed-update-command', but only sometimes. | ||
143 | If any of the predicates in `+elfeed-update-proceed-hook' return | ||
144 | nil, don't run `+elfeed-update-command'. If they all return | ||
145 | non-nil, proceed." | ||
146 | (when (run-hook-with-args-until-failure '+elfeed-update-proceed-hook) | ||
147 | (+elfeed-update-command))) | ||
148 | |||
136 | (defun +elfeed--cancel-update-timer () | 149 | (defun +elfeed--cancel-update-timer () |
137 | "Cancel `+elfeed--update-timer'." | 150 | "Cancel `+elfeed--update-timer'." |
138 | (unless +elfeed--update-running | 151 | (unless +elfeed--update-running |
@@ -142,12 +155,10 @@ If multiple items are selected, don't advance." | |||
142 | (defun +elfeed--reinstate-update-timer () | 155 | (defun +elfeed--reinstate-update-timer () |
143 | "Reinstate `+elfeed--update-timer'." | 156 | "Reinstate `+elfeed--update-timer'." |
144 | ;; First, unload the db | 157 | ;; First, unload the db |
145 | (elfeed-db-save) | ||
146 | (elfeed-db-unload) | ||
147 | (setq +elfeed--update-timer | 158 | (setq +elfeed--update-timer |
148 | (run-at-time +elfeed--update-first-time | 159 | (run-at-time +elfeed--update-first-time |
149 | +elfeed--update-repeat | 160 | +elfeed--update-repeat |
150 | #'+elfeed-update-command))) | 161 | #'+elfeed-update-command-wrapper))) |
151 | 162 | ||
152 | (define-minor-mode +elfeed-update-async-mode | 163 | (define-minor-mode +elfeed-update-async-mode |
153 | "Minor mode to update elfeed async-style." | 164 | "Minor mode to update elfeed async-style." |
diff --git a/lisp/+eshell.el b/lisp/+eshell.el index bcab846..b874141 100644 --- a/lisp/+eshell.el +++ b/lisp/+eshell.el | |||
@@ -25,6 +25,22 @@ any directory proferred by `consult-dir'." | |||
25 | 25 | ||
26 | ;;; Start and quit | 26 | ;;; Start and quit |
27 | 27 | ||
28 | ;; from https://old.reddit.com/r/emacs/comments/1zkj2d/advanced_usage_of_eshell/ | ||
29 | (defun +eshell-here () | ||
30 | "Go to eshell and set current directory to current buffer's." | ||
31 | ;; consider: make a new eshell buffer when given a prefix argument. | ||
32 | (interactive) | ||
33 | (let ((dir (file-name-directory (or (buffer-file-name) | ||
34 | default-directory)))) | ||
35 | (eshell) | ||
36 | (eshell/pushd ".") | ||
37 | (cd dir) | ||
38 | (goto-char (point-max)) | ||
39 | (eshell-kill-input) | ||
40 | (eshell-send-input) | ||
41 | (setq-local scroll-margin 0) | ||
42 | (recenter 0))) | ||
43 | |||
28 | (defun +eshell-quit-or-delete-char (arg) | 44 | (defun +eshell-quit-or-delete-char (arg) |
29 | "Delete the character to the right, or quit eshell on an empty line." | 45 | "Delete the character to the right, or quit eshell on an empty line." |
30 | (interactive "p") | 46 | (interactive "p") |
diff --git a/lisp/+org.el b/lisp/+org.el index 3d14c52..2a57fe2 100644 --- a/lisp/+org.el +++ b/lisp/+org.el | |||
@@ -568,5 +568,19 @@ and POST-PROCESS are passed to `org-export-to-file'." | |||
568 | (interactive) | 568 | (interactive) |
569 | (+org-export-clip-to-html nil :subtree)) | 569 | (+org-export-clip-to-html nil :subtree)) |
570 | 570 | ||
571 | ;;; Unsmartify quotes and dashes and stuff. | ||
572 | (defun +org-unsmartify () | ||
573 | "Replace \"smart\" punctuation with their \"dumb\" counterparts." | ||
574 | (interactive) | ||
575 | (save-excursion | ||
576 | (goto-char (point-min)) | ||
577 | (while (re-search-forward "[“”‘’–—]" nil t) | ||
578 | (let ((replace (pcase (match-string 0) | ||
579 | ((or "“" "”") "\"") | ||
580 | ((or "‘" "’") "'") | ||
581 | ("–" "--") | ||
582 | ("—" "---")))) | ||
583 | (replace-match replace nil nil))))) | ||
584 | |||
571 | (provide '+org) | 585 | (provide '+org) |
572 | ;;; +org.el ends here | 586 | ;;; +org.el ends here |
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index f0c4f62..1f4745d 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el | |||
@@ -54,7 +54,7 @@ | |||
54 | "Display a notmuch count in the tab-bar." | 54 | "Display a notmuch count in the tab-bar." |
55 | (when (and (executable-find "notmuch") | 55 | (when (and (executable-find "notmuch") |
56 | (featurep 'notmuch)) | 56 | (featurep 'notmuch)) |
57 | (let* ((counts (notmuch-hello-query-counts notmuch-saved-searches)) | 57 | (let* ((counts (ignore-errors (notmuch-hello-query-counts notmuch-saved-searches))) |
58 | (next (cl-find "inbox" counts :key (lambda (l) (plist-get l :name)) :test 'equal)) | 58 | (next (cl-find "inbox" counts :key (lambda (l) (plist-get l :name)) :test 'equal)) |
59 | (next-count (plist-get next :count))) | 59 | (next-count (plist-get next :count))) |
60 | (when (and next-count (> next-count 0)) | 60 | (when (and next-count (> next-count 0)) |