about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--init.el182
-rw-r--r--lisp/+avy.el60
-rw-r--r--lisp/+emacs.el6
-rw-r--r--lisp/+modeline.el6
-rw-r--r--lisp/+org-drawer-list.el12
-rw-r--r--lisp/+org-wc.el29
-rw-r--r--lisp/+org.el2
-rw-r--r--lisp/+pdf-tools.el38
-rw-r--r--lisp/+scratch.el25
-rw-r--r--lisp/+titlecase.el26
-rw-r--r--lisp/acdw.el26
12 files changed, 322 insertions, 91 deletions
diff --git a/.gitignore b/.gitignore index 4c2cdcd..c521db5 100644 --- a/.gitignore +++ b/.gitignore
@@ -18,6 +18,7 @@ transient/
18var/ 18var/
19eshell/* 19eshell/*
20!eshell/aliases 20!eshell/aliases
21url/
21 22
22# put random stuff in here 23# put random stuff in here
23scratch.el 24scratch.el
diff --git a/init.el b/init.el index 188ef6d..083678a 100644 --- a/init.el +++ b/init.el
@@ -45,8 +45,9 @@
45 "C-c v" #'visible-mode 45 "C-c v" #'visible-mode
46 "C-M-;" #'+lisp-comment-or-uncomment-sexp 46 "C-M-;" #'+lisp-comment-or-uncomment-sexp
47 "M-j" nil 47 "M-j" nil
48 "C-x o" (lambda () (interactive) (switch-to-buffer nil)) 48 "C-x C-o" #'+switch-to-last-buffer
49 "C-x C-o" #'+open-paragraph 49 "C-x o" #'+switch-to-last-buffer
50 "C-x C-l" #'+open-paragraph ; original: downcase-region
50 "C-w" #'+kill-word-backward-or-region 51 "C-w" #'+kill-word-backward-or-region
51 "C-x C-m" #'execute-extended-command ; original: coding systems 52 "C-x C-m" #'execute-extended-command ; original: coding systems
52 "C-<backspace>" #'+backward-kill-word 53 "C-<backspace>" #'+backward-kill-word
@@ -63,7 +64,7 @@
63 ;; Hooks 64 ;; Hooks
64 (add-hook 'prog-mode-hook #'turn-on-auto-fill) 65 (add-hook 'prog-mode-hook #'turn-on-auto-fill)
65 (add-hook 'prog-mode-hook #'font-lock-todo-insinuate) 66 (add-hook 'prog-mode-hook #'font-lock-todo-insinuate)
66 (add-hook 'text-mode-hook #'turn-on-auto-fill) 67 (add-hook 'text-mode-hook #'turn-on-auto-fill) ; XXX: do I want this ??
67 (add-hook 'special-mode-hook #'turn-off-auto-fill) 68 (add-hook 'special-mode-hook #'turn-off-auto-fill)
68 ;; Advice 69 ;; Advice
69 (advice-add #'completing-read-multiple :filter-args #'+crm-indicator) 70 (advice-add #'completing-read-multiple :filter-args #'+crm-indicator)
@@ -153,7 +154,7 @@
153 save-abbrevs 'silent) 154 save-abbrevs 'silent)
154 (with-eval-after-load 'user-save 155 (with-eval-after-load 'user-save
155 (:with-mode edit-abbrevs-mode 156 (:with-mode edit-abbrevs-mode
156 (:hook #'turn-off-user-save-mode))) 157 (:hook #'user-save-mode-disable)))
157 (:hook-into text-mode 158 (:hook-into text-mode
158 circe-chat-mode)) 159 circe-chat-mode))
159 160
@@ -293,7 +294,8 @@
293 dired-dwim-target t) 294 dired-dwim-target t)
294 (:local-set truncate-lines t) 295 (:local-set truncate-lines t)
295 (:bind "<backspace>" #'dired-up-directory 296 (:bind "<backspace>" #'dired-up-directory
296 "j" #'+dired-goto-file) 297 "j" #'+dired-goto-file
298 "C-j" #'dired-up-directory)
297 (:hook #'dired-hide-details-mode 299 (:hook #'dired-hide-details-mode
298 #'hl-line-mode 300 #'hl-line-mode
299 #'lin-mode 301 #'lin-mode
@@ -528,21 +530,33 @@
528 (advice-add 'notmuch-tag :filter-args #'+notmuch-correct-tags) 530 (advice-add 'notmuch-tag :filter-args #'+notmuch-correct-tags)
529 (:option notmuch-saved-searches (list 531 (:option notmuch-saved-searches (list
530 (list :name "inbox" 532 (list :name "inbox"
531 :query (+notmuch-query-concat "tag:inbox" 533 :query (+notmuch-query-concat
532 "NOT tag:Spam") 534 "tag:inbox"
535 "tag:unread"
536 "NOT tag:Spam")
533 :key "i") 537 :key "i")
534 (list :name "lists" 538 (list :name "lists"
535 :query (+notmuch-query-concat "tag:/List/" 539 :query (+notmuch-query-concat
536 "tag:unread") 540 "tag:/List/"
541 "tag:unread")
537 :key "l") 542 :key "l")
538 (list :name "unread" 543 (list :name "unread"
539 :query (+notmuch-query-concat "tag:unread" 544 :query (+notmuch-query-concat
540 "NOT tag:Spam") 545 "tag:unread"
546 "NOT tag:Spam")
541 :key "u") 547 :key "u")
542 (list :name "flagged" :query "tag:flagged" :key "f") 548 (list :name "flagged"
543 (list :name "sent" :query "tag:sent" :key "t") 549 :query "tag:flagged"
544 (list :name "drafts" :query "tag:draft" :key "d") 550 :key "f")
545 (list :name "all mail" :query "*" :key "a")))) 551 (list :name "sent"
552 :query "tag:sent"
553 :key "t")
554 (list :name "drafts"
555 :query "tag:draft"
556 :key "d")
557 (list :name "all mail"
558 :query "*"
559 :key "a"))))
546 (:+leader "m" #'+notmuch-goto "C-m" #'+notmuch-goto 560 (:+leader "m" #'+notmuch-goto "C-m" #'+notmuch-goto
547 "n" #'notmuch "C-n" #'notmuch) 561 "n" #'notmuch "C-n" #'notmuch)
548 ;; For `focus' 562 ;; For `focus'
@@ -582,7 +596,7 @@
582 org-confirm-babel-evaluate nil 596 org-confirm-babel-evaluate nil
583 org-cycle-separator-lines 0 597 org-cycle-separator-lines 0
584 org-directory (sync/ "org/" t) 598 org-directory (sync/ "org/" t)
585 org-ellipsis truncate-string-ellipsis 599 org-ellipsis (or truncate-string-ellipsis "…")
586 org-fontify-done-headline t 600 org-fontify-done-headline t
587 org-fontify-quote-and-verse-blocks t 601 org-fontify-quote-and-verse-blocks t
588 org-fontify-whole-heading-line t 602 org-fontify-whole-heading-line t
@@ -614,7 +628,7 @@
614 org-src-window-setup 'current-window 628 org-src-window-setup 'current-window
615 org-startup-truncated nil 629 org-startup-truncated nil
616 org-startup-with-inline-images t 630 org-startup-with-inline-images t
617 org-tags-column 1 ;; (- (- fill-column (length org-ellipsis))) 631 org-tags-column (- (- fill-column (length org-ellipsis)))
618 org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" "ONGOING(o@)" 632 org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" "ONGOING(o@)"
619 "|" "DONE(d!)") 633 "|" "DONE(d!)")
620 (sequence "|" "CANCELED(k@)") 634 (sequence "|" "CANCELED(k@)")
@@ -672,7 +686,6 @@
672 ;; (let ((ch (string-to-char (car emph)))) 686 ;; (let ((ch (string-to-char (car emph))))
673 ;; (cons ch ch))) 687 ;; (cons ch ch)))
674 ;; org-emphasis-alist)) 688 ;; org-emphasis-alist))
675 ;;+modeline-position-function #'+org-count-words-stupidly
676 ) 689 )
677 (:local-hook user-save-hook #'+org-before-save@prettify-buffer) 690 (:local-hook user-save-hook #'+org-before-save@prettify-buffer)
678 (advice-add #'org-delete-backward-char :override #'+org-delete-backward-char) 691 (advice-add #'org-delete-backward-char :override #'+org-delete-backward-char)
@@ -920,6 +933,11 @@
920 (widen) 933 (widen)
921 (string-equal (buffer-substring 1 10) ";; Emacs:"))))))) 934 (string-equal (buffer-substring 1 10) ";; Emacs:")))))))
922 935
936(setup whitespace
937 (:option whitespace-line-column nil
938 whitespace-style '(face trailing tabs tab-mark))
939 (:hook-into text-mode prog-mode))
940
923(setup (:straight 0x0) 941(setup (:straight 0x0)
924 (:option 0x0-default-server 'ttm) 942 (:option 0x0-default-server 'ttm)
925 (with-eval-after-load 'embark 943 (with-eval-after-load 'embark
@@ -986,7 +1004,8 @@
986 (:bind-into isearch 1004 (:bind-into isearch
987 "M-j" #'avy-isearch) 1005 "M-j" #'avy-isearch)
988 (:when-loaded 1006 (:when-loaded
989 (setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark))) 1007 (setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark)
1008 (+avy-buffer-face-mode +1)))
990 1009
991(setup (:straight bbdb) 1010(setup (:straight bbdb)
992 (:straight bbdb-vcard) 1011 (:straight bbdb-vcard)
@@ -1228,7 +1247,8 @@
1228 (:hook #'visual-line-mode 1247 (:hook #'visual-line-mode
1229 #'enable-lui-track 1248 #'enable-lui-track
1230 #'visual-fill-column-mode 1249 #'visual-fill-column-mode
1231 #'enable-lui-autopaste) 1250 #'enable-lui-autopaste
1251 )
1232 (:local-set fringes-outside-margins t 1252 (:local-set fringes-outside-margins t
1233 right-margin-width (length lui-time-stamp-format) 1253 right-margin-width (length lui-time-stamp-format)
1234 scroll-margin 0 1254 scroll-margin 0
@@ -1478,8 +1498,9 @@
1478(setup (:straight edit-server) 1498(setup (:straight edit-server)
1479 (:option edit-server-url-major-mode-alist `(("github\\.com" . ,(if (fboundp 'gfm-mode) 1499 (:option edit-server-url-major-mode-alist `(("github\\.com" . ,(if (fboundp 'gfm-mode)
1480 #'gfm-mode 1500 #'gfm-mode
1481 #'markdown-mode)))) 1501 #'markdown-mode))
1482 (add-hook 'edit-server-done-hook (lambda () (unfill-region (point-min) (point-max)))) 1502 ("reddit\\.com" . markdown-mode)
1503 ("notabug\\.org" . markdown-mode)))
1483 (+with-ensure-after-init 1504 (+with-ensure-after-init
1484 (edit-server-start))) 1505 (edit-server-start)))
1485 1506
@@ -1643,6 +1664,7 @@
1643(setup (:straight (fill-sentences-correctly 1664(setup (:straight (fill-sentences-correctly
1644 :host github 1665 :host github
1645 :repo "duckwork/fill-sentences-correctly.el")) 1666 :repo "duckwork/fill-sentences-correctly.el"))
1667 (:quit "I don't think this works like how I want.")
1646 (fill-sentences-correctly-mode +1)) 1668 (fill-sentences-correctly-mode +1))
1647 1669
1648(setup (:straight (filldent 1670(setup (:straight (filldent
@@ -2034,41 +2056,59 @@
2034 "Prog-mode major mode face.") 2056 "Prog-mode major mode face.")
2035 (modus-themes-with-colors 2057 (modus-themes-with-colors
2036 (custom-set-faces 2058 (custom-set-faces
2037 `(font-lock-builtin-face ((,class :inherit modus-themes-bold 2059 `(font-lock-builtin-face
2038 :foreground unspecified))) 2060 ((,class :inherit modus-themes-bold
2039 `(font-lock-comment-delimiter-face ((,class :inherit font-lock-comment-face))) 2061 :foreground unspecified)))
2040 `(font-lock-comment-face ((,class :inherit variable-pitch 2062 `(font-lock-comment-face
2041 :slant italic 2063 ((,class :inherit variable-pitch
2042 :foreground ,fg-docstring))) 2064 :foreground ,fg-comment-yellow)))
2043 `(font-lock-constant-face ((,class :inherit underline 2065 `(font-lock-comment-delimiter-face
2044 :foreground unspecified))) 2066 ((,class :inherit font-lock-comment-face)))
2045 `(font-lock-doc-face ((,class :inherit modus-themes-slant 2067 `(font-lock-constant-face
2046 :foreground ,fg-docstring))) 2068 ((,class :inherit underline
2047 `(font-lock-function-name-face ((,class :foreground unspecified))) 2069 :foreground unspecified)))
2048 `(font-lock-keyword-face ((,class :inherit modus-themes-bold 2070 `(font-lock-doc-face
2049 :foreground unspecified))) 2071 ((,class :inherit modus-themes-slant
2050 `(font-lock-negation-char-face ((,class :inherit modus-themes-bold 2072 :foreground ,fg-docstring)))
2051 :foreground unspecified))) 2073 `(font-lock-function-name-face
2052 `(font-lock-preprocessor-face ((,class :foreground unspecified))) 2074 ((,class :foreground unspecified
2053 `(font-lock-regexp-grouping-backslash ((,class :foreground ,fg-escape-char-backslash))) 2075 :slant italic)))
2054 `(font-lock-regexp-grouping-construct ((,class :foreground ,fg-escape-char-construct))) 2076 `(font-lock-keyword-face
2055 `(font-lock-string-face ((,class :inherit modus-themes-slant 2077 ((,class :inherit modus-themes-bold
2056 :foreground unspecified))) 2078 :foreground unspecified)))
2057 `(font-lock-type-face ((,class :inherit modus-themes-bold 2079 `(font-lock-negation-char-face
2058 :foreground unspecified))) 2080 ((,class :inherit modus-themes-bold
2059 `(font-lock-variable-name-face ((,class :foreground unspecified))) 2081 :foreground unspecified)))
2060 `(font-lock-warning-face ((,class :inherit modus-themes-bold 2082 `(font-lock-preprocessor-face
2061 :foreground ,red-nuanced-fg))) 2083 ((,class :foreground unspecified)))
2062 `(font-lock-todo-face ((,class :inherit font-lock-comment-face 2084 `(font-lock-regexp-grouping-backslash
2063 :foreground ,fg-header 2085 ((,class :foreground ,fg-escape-char-backslash)))
2064 :background ,yellow-intense-bg))) 2086 `(font-lock-regexp-grouping-construct
2065 `(+modeline-text-mode-face ((,class :foreground ,blue 2087 ((,class :foreground ,fg-escape-char-construct)))
2066 :inherit modus-themes-bold))) 2088 `(font-lock-string-face
2067 `(+modeline-prog-mode-face ((,class :foreground ,magenta 2089 ((,class :foreground ,fg-special-warm)))
2068 :inherit modus-themes-bold)))) 2090 `(font-lock-type-face
2069 (:option +modeline-major-mode-faces `((text-mode . +modeline-text-mode-face) 2091 ((,class :inherit modus-themes-bold
2070 (prog-mode . +modeline-prog-mode-face) 2092 :foreground unspecified)))
2071 (t . bold)))))) 2093 `(font-lock-variable-name-face
2094 ((,class :foreground unspecified)))
2095 `(font-lock-warning-face
2096 ((,class :inherit modus-themes-bold
2097 :foreground ,red-nuanced-fg)))
2098 `(font-lock-todo-face
2099 ((,class :inherit font-lock-comment-face
2100 :foreground ,fg-header
2101 :background ,yellow-intense-bg)))
2102 `(+modeline-text-mode-face
2103 ((,class :foreground ,blue
2104 :inherit modus-themes-bold)))
2105 `(+modeline-prog-mode-face
2106 ((,class :foreground ,magenta
2107 :inherit modus-themes-bold))))
2108 (:option +modeline-major-mode-faces
2109 `((text-mode . +modeline-text-mode-face)
2110 (prog-mode . +modeline-prog-mode-face)
2111 (t . bold))))))
2072 2112
2073 (require 'dawn) 2113 (require 'dawn)
2074 (dawn-schedule #'modus-themes-load-operandi 2114 (dawn-schedule #'modus-themes-load-operandi
@@ -2235,10 +2275,22 @@
2235(setup (:straight pdf-tools 2275(setup (:straight pdf-tools
2236 (or (executable-find "gcc") 2276 (or (executable-find "gcc")
2237 (executable-find "g++"))) 2277 (executable-find "g++")))
2278 (:also-load +pdf-tools)
2279 (:with-mode pdf-view-mode
2280 (:local-set +modeline-position-function #'+pdf-view-position))
2238 (setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal) 2281 (setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal)
2239 #'pdf-view-mode) 2282 #'pdf-view-mode)
2240 (pdf-tools-install :no-query)) 2283 (pdf-tools-install :no-query))
2241 2284
2285(setup (:straight persistent-scratch)
2286 (:require)
2287 (:option persistent-scratch-save-file (sync/ "emacs/scratch")
2288 persistent-scratch-backup-directory (sync/ "emacs/scratch.d/" t)
2289 persistent-scratch-backup-file-name-format "%Y-%m-%dT%H:%M_%s")
2290 (persistent-scratch-autosave-mode +1)
2291 (+mapc-some-buffers (lambda () (persistent-scratch-mode +1))
2292 persistent-scratch-scratch-buffer-p-function))
2293
2242(setup (:straight (plancat 2294(setup (:straight (plancat
2243 :host github 2295 :host github
2244 :repo "duckwork/plancat.el" 2296 :repo "duckwork/plancat.el"
@@ -2310,7 +2362,7 @@
2310 +modeline-narrowed 2362 +modeline-narrowed
2311 +modeline-text-scale 2363 +modeline-text-scale
2312 +modeline-input-method) 2364 +modeline-input-method)
2313 ",") 2365 " ")
2314 +modeline-major-mode 2366 +modeline-major-mode
2315 +modeline-spacer))) 2367 +modeline-spacer)))
2316 (simple-modeline-mode +1)) 2368 (simple-modeline-mode +1))
@@ -2356,12 +2408,14 @@
2356 #'view-hello-file 2408 #'view-hello-file
2357 #'describe-gnu-project 2409 #'describe-gnu-project
2358 #'suspend-frame) 2410 #'suspend-frame)
2411 (sophomore-disable-with 'confirm
2412 #'+save-buffers-quit
2413 #'save-buffers-kill-terminal)
2359 (sophomore-mode +1)) 2414 (sophomore-mode +1))
2360 2415
2361(setup (:straight (spongebob-case 2416(setup (:straight (spongebob-case
2362 :host github 2417 :host github
2363 :repo "duckwork/spongebob-case.el")) 2418 :repo "duckwork/spongebob-case.el")))
2364 (define-key +casing-map (kbd "M-s") #'spongebob-case-dwim))
2365 2419
2366(setup (:straight ssh-config-mode) 2420(setup (:straight ssh-config-mode)
2367 (:file-match (rx "/.ssh/config" eos) 2421 (:file-match (rx "/.ssh/config" eos)
@@ -2388,10 +2442,12 @@
2388 :host github 2442 :host github
2389 :repo "duckwork/titlecase.el" 2443 :repo "duckwork/titlecase.el"
2390 :files ("*"))) 2444 :files ("*")))
2391 (:require titlecase) 2445 (:require titlecase +titlecase)
2392 (:with-map +casing-map 2446 (:with-map +casing-map
2393 (:bind "t" #'titlecase-dwim 2447 (:bind "t" #'titlecase-dwim
2394 "M-t" #'titlecase-dwim))) 2448 "M-t" #'titlecase-dwim
2449 "s" #'+titlecase-sentence-style-dwim
2450 "M-s" #'+titlecase-sentence-style-dwim)))
2395 2451
2396(setup (:straight topsy) 2452(setup (:straight topsy)
2397 (:hook-into ;;prog-mode 2453 (:hook-into ;;prog-mode
@@ -2448,6 +2504,8 @@
2448 :host github 2504 :host github
2449 :repo "casouri/undo-hl")) 2505 :repo "casouri/undo-hl"))
2450 (:require) 2506 (:require)
2507 (:face 'undo-hl-delete '((t :strikethrough t))
2508 'undo-hl-insert '((t :underline t)))
2451 (:hook-into text-mode prog-mode)) 2509 (:hook-into text-mode prog-mode))
2452 2510
2453(setup (:straight unfill)) 2511(setup (:straight unfill))
diff --git a/lisp/+avy.el b/lisp/+avy.el index 5010e95..0606405 100644 --- a/lisp/+avy.el +++ b/lisp/+avy.el
@@ -17,5 +17,65 @@
17 (cdr (ring-ref avy-ring 0)))) 17 (cdr (ring-ref avy-ring 0))))
18 t) 18 t)
19 19
20
21;;; Remove `buffer-face-mode' when avy is active.
22
23(defcustom +avy-buffer-face-functions '(avy-goto-char
24 avy-goto-char-in-line
25 avy-goto-char-2
26 avy-goto-char-2-above
27 avy-goto-char-2-below
28 avy-goto-word-0
29 avy-goto-whitespace-end
30 avy-goto-word-0-above
31 avy-goto-word-0-below
32 avy-goto-whitespace-end-above
33 avy-goto-whitespace-end-below
34 avy-goto-word-1
35 avy-goto-word-1-above
36 avy-goto-word-1-below
37 avy-goto-symbol-1
38 avy-goto-symbol-1-above
39 avy-goto-symbol-1-below
40 avy-goto-subword-0
41 avy-goto-subword-1
42 avy-goto-word-or-subword-1
43 avy-goto-line
44 avy-goto-line-above
45 avy-goto-line-below
46 avy-goto-end-of-line
47 avy-goto-char-timer)
48 "Functions to disable `buffer-face-mode' during.")
49
50(defvar-local +avy-buffer-face-mode-face nil
51 "The state of `buffer-face-mode' before calling `avy-with'.")
52
53(defun +avy@un-buffer-face (&rest _)
54 "BEFORE advice on `avy-with' to disable `buffer-face-mode'."
55 (when buffer-face-mode
56 (setq +avy-buffer-face-mode-face buffer-face-mode-face)
57 (buffer-face-mode -1)))
58
59(defun +avy@re-buffer-face (&rest _)
60 "AFTER advice on `avy-with' to re-enable `buffer-face-mode'."
61 (when +avy-buffer-face-mode-face
62 (setq buffer-face-mode-face +avy-buffer-face-mode-face)
63 (buffer-face-mode +1)))
64
65(define-minor-mode +avy-buffer-face-local-mode
66 "Turn off `buffer-face-mode' before doing Avy selections.
67Restore the mode after the selection."
68 :lighter ""
69 :global t
70 (setq +avy-buffer-face-mode-face nil)
71 (cond
72 (+avy-buffer-face-mode
73 (dolist (fn +avy-buffer-face-functions)
74 (advice-add fn :before #'+avy@un-buffer-face))
75 (advice-add 'avy--done :after #'+avy@re-buffer-face))
76 (t (dolist (fn +avy-buffer-face-functions)
77 (advice-remove fn #'+avy@un-buffer-face))
78 (advice-remove 'avy--done #'+avy@re-buffer-face))))
79
20(provide '+avy) 80(provide '+avy)
21;;; avy.el ends here 81;;; avy.el ends here
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 3c5d383..dedde98 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -73,8 +73,6 @@ Do this only if the buffer is not visiting a file."
73 (executable-find "gm") 73 (executable-find "gm")
74 (executable-find "ffmpeg")) 74 (executable-find "ffmpeg"))
75 indent-tabs-mode nil 75 indent-tabs-mode nil
76 indicate-buffer-boundaries 'left
77 indicate-empty-lines nil
78 inhibit-startup-screen t 76 inhibit-startup-screen t
79 initial-buffer-choice t 77 initial-buffer-choice t
80 kept-new-versions 6 78 kept-new-versions 6
@@ -98,9 +96,11 @@ Do this only if the buffer is not visiting a file."
98 native-comp-deferred-compilation nil 96 native-comp-deferred-compilation nil
99 read-answer-short t 97 read-answer-short t
100 read-buffer-completion-ignore-case t 98 read-buffer-completion-ignore-case t
101 ;; read-extended-command-predicate (when (fboundp 99 ;; read-extended-command-predicate
100 ;; (when (fboundp
102 ;; 'command-completion-default-include-p) 101 ;; 'command-completion-default-include-p)
103 ;; 'command-completion-default-include-p) 102 ;; 'command-completion-default-include-p)
103 read-process-output-max (+bytes 1 :mib) ; We’re in the future man. Set that to at least a megabyte
104 recenter-positions '(top middle bottom) 104 recenter-positions '(top middle bottom)
105 regexp-search-ring-max 100 105 regexp-search-ring-max 100
106 regexp-search-ring-max 200 106 regexp-search-ring-max 200
diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 86dbad4..2c9bbee 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el
@@ -393,9 +393,9 @@ to a function in the current buffer, call that function instead."
393 ;; adapted from https://github.com/seagle0128/doom-modeline 393 ;; adapted from https://github.com/seagle0128/doom-modeline
394 (when (and (boundp 'text-scale-mode-amount) 394 (when (and (boundp 'text-scale-mode-amount)
395 (/= text-scale-mode-amount 0)) 395 (/= text-scale-mode-amount 0))
396 (format (if (> text-scale-mode-amount 0) "%s(%+d)" "%s(%-d)") 396 (+modeline-spacer nil spacer
397 (or spacer +modeline-default-spacer) 397 (concat (if (> text-scale-mode-amount 0) "+" "-")
398 text-scale-mode-amount))) 398 (number-to-string text-scale-mode-amount)))))
399 399
400(defun +modeline-ace-window-display (&optional spacer) 400(defun +modeline-ace-window-display (&optional spacer)
401 "Display `ace-window-display-mode' information in the modeline." 401 "Display `ace-window-display-mode' information in the modeline."
diff --git a/lisp/+org-drawer-list.el b/lisp/+org-drawer-list.el index 2fc7234..5066d4d 100644 --- a/lisp/+org-drawer-list.el +++ b/lisp/+org-drawer-list.el
@@ -26,7 +26,7 @@ format the list item as an Org link."
26 "mailto"))) 26 "mailto")))
27 (current-kill 0)) 27 (current-kill 0))
28 (string-trim (current-kill 0)) 28 (string-trim (current-kill 0))
29 (read-string "URL: "))) 29 (read-string "Resource URL: ")))
30 (url-title (let ((clipboard-headings 30 (url-title (let ((clipboard-headings
31 (+org-insert--get-title-and-headings clipboard-url))) 31 (+org-insert--get-title-and-headings clipboard-url)))
32 (read-string "title (edit): " 32 (read-string "title (edit): "
@@ -34,8 +34,14 @@ format the list item as an Org link."
34 "title: " clipboard-headings 34 "title: " clipboard-headings
35 nil nil nil nil (car clipboard-headings)))))) 35 nil nil nil nil (car clipboard-headings))))))
36 (list clipboard-url url-title))) 36 (list clipboard-url url-title)))
37 (org-drawer-list-add +org-drawer-list-resources-drawer 37 (let (current-visible-mode visible-mode)
38 (org-link-make-string url title))) 38 ;; XXX: This is not the "proper" way to fix the issue I was having --- I've
39 ;; isolated the bug to somewhere in `org-insert-item', but this fix works
40 ;; well enough™ for now.
41 (visible-mode +1)
42 (org-drawer-list-add +org-drawer-list-resources-drawer
43 (org-link-make-string url title))
44 (visible-mode (if current-visible-mode +1 -1))))
39 45
40(provide '+org-drawer-list) 46(provide '+org-drawer-list)
41;;; +org-drawer-list.el ends here 47;;; +org-drawer-list.el ends here
diff --git a/lisp/+org-wc.el b/lisp/+org-wc.el index 7ab0050..edd88f0 100644 --- a/lisp/+org-wc.el +++ b/lisp/+org-wc.el
@@ -19,8 +19,7 @@
19(defcustom +org-wc-update-after-funcs '(org-narrow-to-subtree 19(defcustom +org-wc-update-after-funcs '(org-narrow-to-subtree
20 org-narrow-to-block 20 org-narrow-to-block
21 org-narrow-to-element 21 org-narrow-to-element
22 org-capture-narrow 22 org-capture-narrow)
23 org-taskwise-narrow-to-task)
24 "Functions after which to update the word count." 23 "Functions after which to update the word count."
25 :type '(repeat function)) 24 :type '(repeat function))
26 25
@@ -32,6 +31,16 @@
32 "Number of characters that constitute a \"huge\" insertion." 31 "Number of characters that constitute a \"huge\" insertion."
33 :type 'number) 32 :type 'number)
34 33
34(defcustom +org-wc-huge-buffer 10000
35 "Number of words past which we're not going to try to count."
36 :type 'number)
37
38(defvar +org-wc-correction -5
39 "Number to add to `+org-wc-word-count', for some reason?
40`+org-wc-word-count' seems to consistently be off by 5. Thus
41this correction. (At some point I should correct the underlying
42code... probably).")
43
35(defvar-local +org-wc-update-timer nil) 44(defvar-local +org-wc-update-timer nil)
36 45
37(defun +org-wc-delayed-update (&rest _) 46(defun +org-wc-delayed-update (&rest _)
@@ -48,7 +57,7 @@
48 (+org-wc-update) 57 (+org-wc-update)
49 (message "Counting words...done")) 58 (message "Counting words...done"))
50 59
51(defun +org-wc-update () 60(defun +org-wc-update (&rest _) ; Needs variadic parameters, since it's advice
52 (dlet ((+org-wc-counting t)) 61 (dlet ((+org-wc-counting t))
53 (+org-wc-buffer) 62 (+org-wc-buffer)
54 (force-mode-line-update) 63 (force-mode-line-update)
@@ -59,9 +68,14 @@
59 68
60(defun +org-wc-buffer () 69(defun +org-wc-buffer ()
61 "Count the words in the buffer." 70 "Count the words in the buffer."
62 (when (derived-mode-p 'org-mode) 71 (when (and (derived-mode-p 'org-mode)
72 (not (eq +org-wc-word-count 'huge)))
63 (setq +org-wc-word-count 73 (setq +org-wc-word-count
64 (org-word-count-aux (point-min) (point-max))))) 74 (cond
75 ((> (count-words (point-min) (point-max))
76 +org-wc-huge-buffer)
77 'huge)
78 (t (org-word-count-aux (point-min) (point-max)))))))
65 79
66(defvar +org-wc-counting nil 80(defvar +org-wc-counting nil
67 "Are we currently counting?") 81 "Are we currently counting?")
@@ -71,8 +85,9 @@
71 (+org-wc-update))) 85 (+org-wc-update)))
72 86
73(defun +org-wc-modeline () 87(defun +org-wc-modeline ()
74 (when +org-wc-word-count 88 (cond
75 (format " %sw" +org-wc-word-count))) 89 ((eq +org-wc-word-count 'huge) "huge")
90 (+org-wc-word-count (format " %sw" (max 0 (+ +org-wc-word-count +org-wc-correction))))))
76 91
77(define-minor-mode +org-wc-mode 92(define-minor-mode +org-wc-mode
78 "Count words in `org-mode' buffers in the mode-line." 93 "Count words in `org-mode' buffers in the mode-line."
diff --git a/lisp/+org.el b/lisp/+org.el index 89ed483..6b93a7a 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -669,7 +669,7 @@ and POST-PROCESS are passed to `org-export-to-file'."
669 "Advice to run `org-mode-hook' when entering org-mode. 669 "Advice to run `org-mode-hook' when entering org-mode.
670This should only fire when switching to a buffer from `org-agenda'." 670This should only fire when switching to a buffer from `org-agenda'."
671 (unless +org-hook-has-run-p 671 (unless +org-hook-has-run-p
672 (run-hooks 'org-mode-hook) 672 (run-mode-hooks 'org-mode-hook)
673 (setq +org-hook-has-run-p t))) 673 (setq +org-hook-has-run-p t)))
674 674
675(define-minor-mode +org-agenda-inhibit-hooks-mode 675(define-minor-mode +org-agenda-inhibit-hooks-mode
diff --git a/lisp/+pdf-tools.el b/lisp/+pdf-tools.el new file mode 100644 index 0000000..9b15b27 --- /dev/null +++ b/lisp/+pdf-tools.el
@@ -0,0 +1,38 @@
1;;; +pdf-tools.el --- Extras for the excellent pdf-tools' -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;;; Code:
6
7;; XXX: The way I'm dispatching browsers here is /very/ down-and-dirty. It
8;; needs to be much improved.
9
10(defun +pdf-view-open-all-pagelinks (&optional browse-url-func)
11 "Open all the links on this page of a PDF.
12BROWSE-URL-FUNC overrides the default `browse-url'."
13 (interactive)
14 (let ((links (pdf-info-pagelinks (pdf-view-current-page)))
15 (browse-url-func (or browse-url-func #'browse-url))
16 (seen))
17 (dolist (link links)
18 (when-let* ((uri (alist-get 'uri link))
19 (_ (not (member uri seen))))
20 (push uri seen)
21 (funcall browse-url-func uri)))))
22
23(defun +pdf-view-open-links-in-chrome ()
24 "Open all links on this PDF page in Chrome.
25See also `+pdf-view-open-all-pagelinks'."
26 (interactive)
27 (+pdf-view-open-all-pagelinks #'browse-url-chrome))
28
29(defun +pdf-view-position (&optional spacer)
30 "Return the page we're on for the modeline."
31 (when (derived-mode-p 'pdf-view-mode)
32 (format "%sp.%s/%s"
33 (or spacer (bound-and-true-p +modeline-default-spacer) " ")
34 (pdf-view-current-page)
35 (pdf-info-number-of-pages))))
36
37(provide '+pdf-tools)
38;;; +pdf-tools.el ends here
diff --git a/lisp/+scratch.el b/lisp/+scratch.el index e9b825a..7fc2bde 100644 --- a/lisp/+scratch.el +++ b/lisp/+scratch.el
@@ -35,18 +35,33 @@ For `kill-buffer-query-functions'."
35 "ABANDON ALL HOPE YE WHO ENTER HERE")))) 35 "ABANDON ALL HOPE YE WHO ENTER HERE"))))
36 (concat (replace-regexp-in-string "^" ";; " s) 36 (concat (replace-regexp-in-string "^" ";; " s)
37 "\n\n"))) 37 "\n\n")))
38 38
39;; [[https://old.reddit.com/r/emacs/comments/ui1q41/weekly_tips_tricks_c_thread/i7ef4xg/][u/bhrgunatha]] 39;; [[https://old.reddit.com/r/emacs/comments/ui1q41/weekly_tips_tricks_c_thread/i7ef4xg/][u/bhrgunatha]]
40(defun +scratch-text-scratch () 40(defun +scratch-text-scratch ()
41 "Create a \"*text*\" scratch buffer in Text mode." 41 "Create a \"*text*\" scratch buffer in Text mode."
42 (with-current-buffer (get-buffer-create "*text*") 42 (with-current-buffer (get-buffer-create "*text*")
43 (text-mode))) 43 (text-mode)))
44 44
45(defcustom +scratch-buffers '("*text*" "*scratch*")
46 "Scratch buffers.")
47
48(defvar +scratch-last-non-scratch-buffer nil
49 "Last buffer that wasn't a scratch buffer.")
50
45(defun +scratch-toggle (buffer) 51(defun +scratch-toggle (buffer)
46 "Switch to BUFFER, or to the previous buffer." 52 "Switch to BUFFER, or to the previous (non-scratch) buffer."
47 (switch-to-buffer (unless (eq (current-buffer) 53 (if (or (null +scratch-last-non-scratch-buffer)
48 (get-buffer buffer)) 54 (not (member (buffer-name (current-buffer)) +scratch-buffers)))
49 buffer))) 55 ;; Switch to a scratch buffer
56 (progn
57 (setq +scratch-last-non-scratch-buffer (current-buffer))
58 (switch-to-buffer buffer))
59 ;; Switch away from scratch buffer ...
60 (if (equal (get-buffer-create buffer) (current-buffer))
61 ;; to the original buffer
62 (switch-to-buffer +scratch-last-non-scratch-buffer)
63 ;; to another scratch
64 (switch-to-buffer buffer))))
50 65
51(defun +scratch-switch-to-scratch () 66(defun +scratch-switch-to-scratch ()
52 "Switch to scratch buffer." 67 "Switch to scratch buffer."
diff --git a/lisp/+titlecase.el b/lisp/+titlecase.el new file mode 100644 index 0000000..1366a46 --- /dev/null +++ b/lisp/+titlecase.el
@@ -0,0 +1,26 @@
1;;; +titlecase.el --- Titlecase extras -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;;; Code:
6
7(defun +titlecase-sentence-style-dwim ()
8 "Titlecase a sentence."
9 (interactive)
10 (titlecase-dwim 'sentence))
11
12(defun +titlecase-org-headings ()
13 (interactive)
14 (save-excursion
15 (goto-char (point-min))
16 ;; See also `org-map-tree'. I'm not using that function because I want to
17 ;; skip the first headline. A better solution would be to patch
18 ;; `titlecase-line' to ignore org-mode metadata (TODO cookies, tags, etc).
19 (let ((level (funcall outline-level)))
20 (while (and (progn (outline-next-heading)
21 (> (funcall outline-level) level))
22 (not (eobp)))
23 (titlecase-line)))))
24
25(provide '+titlecase)
26;;; +titlecase.el ends here
diff --git a/lisp/acdw.el b/lisp/acdw.el index 9b3ab93..191cdfb 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -282,7 +282,8 @@ always nil; this function is mostly intended for use in init."
282 282
283(defcustom chat-functions '(+irc 283(defcustom chat-functions '(+irc
284 jabber-connect-all 284 jabber-connect-all
285 slack-start) 285 ;; slack-start
286 )
286 "Functions to start when calling `chat'." 287 "Functions to start when calling `chat'."
287 :type '(repeat function) 288 :type '(repeat function)
288 :group 'applications) 289 :group 'applications)
@@ -292,16 +293,17 @@ always nil; this function is mostly intended for use in init."
292 (interactive) 293 (interactive)
293 (+with-progress "Quitting circe..." 294 (+with-progress "Quitting circe..."
294 (ignore-errors 295 (ignore-errors
295 (circe-command-GQUIT " 🫀 🍞") 296 (circe-command-GQUIT "peace love bread")
296 (cancel-timer (irc-connection-get conn :flood-timer)))) 297 (cancel-timer (irc-connection-get conn :flood-timer))))
297 (+with-progress "Quitting jabber..." 298 (+with-progress "Quitting jabber..."
298 (ignore-errors 299 (ignore-errors
299 (jabber-disconnect))) 300 (jabber-disconnect)))
300 (+with-progress "Quitting-slack..." 301 (when (boundp '+slack-teams)
301 (dolist (team +slack-teams) 302 (+with-progress "Quitting-slack..."
302 (ignore-errors 303 (dolist (team +slack-teams)
303 (slack-team-disconnect team))) 304 (ignore-errors
304 (ignore-errors (slack-ws-close))) 305 (slack-team-disconnect team)))
306 (ignore-errors (slack-ws-close))))
305 (+with-progress "Killing buffers..." 307 (+with-progress "Killing buffers..."
306 (ignore-errors 308 (ignore-errors
307 (+mapc-some-buffers (lambda () "Remove the buffer from tracking and kill it unconditionally." 309 (+mapc-some-buffers (lambda () "Remove the buffer from tracking and kill it unconditionally."
@@ -496,6 +498,9 @@ sort order."
496 (lambda () 498 (lambda ()
497 (message "%S-second timer DONE!" secs) 499 (message "%S-second timer DONE!" secs)
498 (setq +timer-string +timer-done-string) 500 (setq +timer-string +timer-done-string)
501 (let ((visible-bell t)
502 (ring-bell-function nil))
503 (ding))
499 (ding)))))) 504 (ding))))))
500 505
501(defun +timer-cancel () 506(defun +timer-cancel ()
@@ -508,5 +513,12 @@ sort order."
508 (message "Timer canceled."))) 513 (message "Timer canceled.")))
509 (setq +timer-string nil)) 514 (setq +timer-string nil))
510 515
516
517
518(defun +switch-to-last-buffer ()
519 "Switch to the last-used buffer in this window."
520 (interactive)
521 (switch-to-buffer nil))
522
511(provide 'acdw) 523(provide 'acdw)
512;;; acdw.el ends here 524;;; acdw.el ends here