about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO.org1
-rw-r--r--init.el99
-rw-r--r--lisp/acdw-irc.el12
-rw-r--r--lisp/acdw-modeline.el12
-rw-r--r--lisp/acdw.el45
5 files changed, 106 insertions, 63 deletions
diff --git a/TODO.org b/TODO.org index 9a3d8f9..336a550 100644 --- a/TODO.org +++ b/TODO.org
@@ -20,6 +20,7 @@ I just have to make sure it's loading correctly in my own config… bleh
20 - [ ] =(╥﹏╥)= 20 - [ ] =(╥﹏╥)=
21 - [ ] =Σ ◕ ◡ ◕= 21 - [ ] =Σ ◕ ◡ ◕=
22 - [ ] =╭∩╮(︶_︶)╭∩╮= 22 - [ ] =╭∩╮(︶_︶)╭∩╮=
23 - [ ] =(งツ)ว=
23 - [ ] =ʕ ᴖᴥᴖʔ= 24 - [ ] =ʕ ᴖᴥᴖʔ=
24 25
25** TODO keep-acs (name?) 26** TODO keep-acs (name?)
diff --git a/init.el b/init.el index 47f672f..4a4c57c 100644 --- a/init.el +++ b/init.el
@@ -113,7 +113,8 @@ AKA, DO NOT USE THIS FUNCTION!!!"
113 (:option auth-sources '("~/.authinfo" "~/.authinfo.gpg"))) 113 (:option auth-sources '("~/.authinfo" "~/.authinfo.gpg")))
114 114
115(setup autorevert 115(setup autorevert
116 (:option global-auto-revert-non-file-buffers t) 116 (:option global-auto-revert-non-file-buffers t
117 auto-revert-verbose nil)
117 (global-auto-revert-mode +1)) 118 (global-auto-revert-mode +1))
118 119
119(setup (:straight avy) 120(setup (:straight avy)
@@ -257,15 +258,28 @@ AKA, DO NOT USE THIS FUNCTION!!!"
257 258
258 circe-command-QUIT :after 259 circe-command-QUIT :after
259 (defun circe-quit@kill-buffer (&rest _) 260 (defun circe-quit@kill-buffer (&rest _)
260 (let ((circe-server-killed-confirmation 'kill-all)) 261 ;; `circe-server-killed-confirmation' set to nil, and manually
262 ;; deleting all chat buffers, pending Github issue #402
263 ;; (https://github.com/emacs-circe/circe/issues/402)
264 (let ((circe-server-killed-confirmation nil))
261 (with-circe-server-buffer 265 (with-circe-server-buffer
266 (dolist (buf (circe-server-chat-buffers))
267 (let ((circe-channel-killed-confirmation nil))
268 (kill-buffer buf)))
262 (kill-buffer)))) 269 (kill-buffer))))
263 270
264 circe-command-GQUIT :after 271 circe-command-GQUIT :after
265 (defun circe-gquit@kill-buffer (&rest _) 272 (defun circe-gquit@kill-buffer (&rest _)
266 (let ((circe-server-killed-confirmation 'kill-all)) 273 ;; `circe-server-killed-confirmation' set to nil, and manually
274 ;; deleting all chat buffers, pending Github issue #402
275 ;; (https://github.com/emacs-circe/circe/issues/402)
276 (let ((circe-server-killed-confirmation nil))
267 (dolist (buf (circe-server-buffers)) 277 (dolist (buf (circe-server-buffers))
268 (with-current-buffer buf 278 (with-current-buffer buf
279 (dolist (buf (circe-server-chat-buffers))
280 (let ((circe-channel-killed-confirmation nil))
281 (kill-buffer buf)))
282 (message "%s: %s" buf circe-server-killed-confirmation)
269 (kill-buffer)))))) 283 (kill-buffer))))))
270 284
271 (defun circe-command-SHORTEN (url) 285 (defun circe-command-SHORTEN (url)
@@ -469,8 +483,8 @@ AKA, DO NOT USE THIS FUNCTION!!!"
469 (:hook visual-line-mode)) 483 (:hook visual-line-mode))
470 484
471(setup (:straight-if (define-repeat-map 485(setup (:straight-if (define-repeat-map
472 :host nil 486 :host nil
473 :repo "https://tildegit.org/acdw/define-repeat-map.el") 487 :repo "https://tildegit.org/acdw/define-repeat-map.el")
474 (acdw/system :home)) 488 (acdw/system :home))
475 489
476 (defun acdw/other-window-or-switch-buffer-backward () 490 (defun acdw/other-window-or-switch-buffer-backward ()
@@ -607,8 +621,7 @@ AKA, DO NOT USE THIS FUNCTION!!!"
607 621
608;; requires extension: 622;; requires extension:
609;; https://addons.mozilla.org/en-US/firefox/addon/edit-with-emacs1/ 623;; https://addons.mozilla.org/en-US/firefox/addon/edit-with-emacs1/
610(setup (:straight-if edit-server 624(setup (:straight edit-server)
611 (daemonp))
612 (:require edit-server) 625 (:require edit-server)
613 (edit-server-start) 626 (edit-server-start)
614 627
@@ -769,8 +782,7 @@ AKA, DO NOT USE THIS FUNCTION!!!"
769 "C-x o" #'acdw/other-window-or-switch-buffer 782 "C-x o" #'acdw/other-window-or-switch-buffer
770 "C-x O" #'acdw/other-window-or-switch-buffer-backward 783 "C-x O" #'acdw/other-window-or-switch-buffer-backward
771 "C-c _" #'add-file-local-variable 784 "C-c _" #'add-file-local-variable
772 "C-x C-c" #'delete-frame ; I keep fat-fingering and exiting 785 "C-x C-c" #'acdw/fat-finger-exit)
773 )
774 786
775 (:with-map toggle-map 787 (:with-map toggle-map
776 (:bind "c" #'column-number-mode 788 (:bind "c" #'column-number-mode
@@ -923,8 +935,19 @@ AKA, DO NOT USE THIS FUNCTION!!!"
923 (load (expand-file-name "eshell" user-emacs-directory)))))) 935 (load (expand-file-name "eshell" user-emacs-directory))))))
924 936
925(setup eww 937(setup eww
938 (defvar-local eww-readable-p nil
939 "Whether current buffer is in readable-mode.")
926 (:option eww-search-prefix "https://duckduckgo.com/html?q=" 940 (:option eww-search-prefix "https://duckduckgo.com/html?q="
927 url-privacy-level '(email agent cookies lastloc)) 941 url-privacy-level '(email agent cookies lastloc))
942
943 (defun eww@is-readable (&rest _)
944 (setq-local eww-readable-p t))
945 (defun eww@is-not-readable (&rest _)
946 (setq-local eww-readable-p nil))
947
948 (advice-add 'eww-readable :after #'eww@is-readable)
949 (advice-add 'eww-render :after #'eww@is-not-readable)
950 (advice-add 'eww-back-url :after #'eww@is-not-readable)
928 951
929 (:hook #'reading-mode)) 952 (:hook #'reading-mode))
930 953
@@ -934,29 +957,7 @@ AKA, DO NOT USE THIS FUNCTION!!!"
934 (exec-path-from-shell-initialize))) 957 (exec-path-from-shell-initialize)))
935 958
936(setup (:straight expand-region) 959(setup (:straight expand-region)
937 (:global "C-=" #'er/expand-region 960 (:global "C-=" #'er/expand-region))
938 "C-SPC"
939 (defun acdw/set-mark-or-expand-region (arg)
940 "Set mark at point and activate, jump to mark, or expand region.
941See `set-mark-command' and `expand-region'.
942
943With no prefix argument, either run `set-mark-command' on first
944invocation and `er/expand-region' on each successive invocation.
945
946With any prefix argument
947(e.g., \\[universal-argument] \\[set-mark-command]), act as with
948`set-mark-command' (i.e., pop the mark). Don't care about
949successive invocations."
950 (interactive "P")
951 (cond
952 ((or arg
953 (and set-mark-command-repeat-pop
954 (eq last-command 'pop-to-mark-command)))
955 (setq this-command 'set-mark-command)
956 (set-mark-command arg))
957 ((eq last-command 'acdw/set-mark-or-expand-region)
958 (er/expand-region 1))
959 (t (set-mark-command arg))))))
960 961
961(setup (:straight-if fennel-mode 962(setup (:straight-if fennel-mode
962 (executable-find "fennel")) 963 (executable-find "fennel"))
@@ -1046,11 +1047,18 @@ specific to most general, they are these:
1046 1047
1047(setup (:straight flyspell-correct) 1048(setup (:straight flyspell-correct)
1048 (:option flyspell-correct-interface #'flyspell-correct-completing-read 1049 (:option flyspell-correct-interface #'flyspell-correct-completing-read
1049 flyspell-correct--cr-key "`") 1050 flyspell-correct--cr-key ";")
1051
1052 (defun acdw/flyspell-correct-f7 ()
1053 "Run a full spell correction on the current buffer."
1054 (interactive)
1055 (save-mark-and-excursion
1056 (flyspell-correct-move 0 :forward :rapid)))
1057
1050 (:with-feature flyspell 1058 (:with-feature flyspell
1051 (:hook (defun flyspell@correct () 1059 (:bind "C-." #'flyspell-correct-wrapper
1052 (:bind "C-;" #'flyspell-correct-wrapper) 1060 "<f7>" #'acdw/flyspell-correct-f7)
1053 (:unbind "C-," "C-." "C-M-i"))))) 1061 (:unbind "C-," "C-." "C-M-i")))
1054 1062
1055(setup (:straight-if forge 1063(setup (:straight-if forge
1056 (acdw/system :home)) 1064 (acdw/system :home))
@@ -1338,9 +1346,11 @@ browser defined in `browse-url-secondary-browser-function'."
1338(setup (:straight markdown-mode) 1346(setup (:straight markdown-mode)
1339 (:file-match (rx ".md" eos) 1347 (:file-match (rx ".md" eos)
1340 (rx ".markdown" eos)) 1348 (rx ".markdown" eos))
1349 (:hook #'variable-pitch-mode)
1341 1350
1342 (:with-mode gfm-mode 1351 (:with-mode gfm-mode
1343 (:file-match (rx "README.md" eos))) 1352 (:file-match (rx "README.md" eos))
1353 (:hook #'variable-pitch-mode))
1344 1354
1345 (when (executable-find "markdownfmt") 1355 (when (executable-find "markdownfmt")
1346 (with-eval-after-load 'apheleia 1356 (with-eval-after-load 'apheleia
@@ -1480,10 +1490,11 @@ browser defined in `browse-url-secondary-browser-function'."
1480 (:option 1490 (:option
1481 org-adapt-indentation nil 1491 org-adapt-indentation nil
1482 org-agenda-files nil ; only until I set this up 1492 org-agenda-files nil ; only until I set this up
1483 org-catch-invisible-edits 'smart 1493 org-catch-invisible-edits 'show-and-error
1484 org-clock-clocked-in-display 'mode-line 1494 org-clock-clocked-in-display 'mode-line
1485 org-clock-string-limit 7 ; gives time and not title 1495 org-clock-string-limit 7 ; gives time and not title
1486 org-confirm-babel-evaluate nil 1496 org-confirm-babel-evaluate nil
1497 org-cycle-separator-lines 0
1487 org-directory "~/org" 1498 org-directory "~/org"
1488 org-ellipsis " …" 1499 org-ellipsis " …"
1489 org-export-coding-system 'utf-8-unix 1500 org-export-coding-system 'utf-8-unix
@@ -1499,6 +1510,9 @@ browser defined in `browse-url-secondary-browser-function'."
1499 org-html-coding-system 'utf-8-unix 1510 org-html-coding-system 'utf-8-unix
1500 org-image-actual-width '(300) 1511 org-image-actual-width '(300)
1501 org-imenu-depth 3 1512 org-imenu-depth 3
1513 org-list-demote-modify-bullet '(("-" . "+")
1514 ("+" . "*")
1515 ("*" . "-"))
1502 org-outline-path-complete-in-steps nil 1516 org-outline-path-complete-in-steps nil
1503 org-pretty-entities t 1517 org-pretty-entities t
1504 org-refile-use-outline-path 'file 1518 org-refile-use-outline-path 'file
@@ -1603,7 +1617,7 @@ browser defined in `browse-url-secondary-browser-function'."
1603 (paredit-mode +1)) 1617 (paredit-mode +1))
1604 1618
1605 (dolist (mode lispy-modes) 1619 (dolist (mode lispy-modes)
1606 (add-hook (intern (concat (symbol-name mode) "-hook")) 1620 (add-hook (intern (format "%s-hook" mode))
1607 #'paredit@setup)) 1621 #'paredit@setup))
1608 1622
1609 (:also-load eldoc) 1623 (:also-load eldoc)
@@ -1611,7 +1625,7 @@ browser defined in `browse-url-secondary-browser-function'."
1611 1625
1612(setup (:straight paren-face) 1626(setup (:straight paren-face)
1613 (dolist (mode lispy-modes) 1627 (dolist (mode lispy-modes)
1614 (add-hook (intern (concat (symbol-name mode) "-hook")) #'paren-face-mode))) 1628 (add-hook (intern (format "%s-hook" mode)) #'paren-face-mode)))
1615 1629
1616(setup (:straight-if (pdf-tools 1630(setup (:straight-if (pdf-tools
1617 :host github 1631 :host github
@@ -1641,8 +1655,8 @@ browser defined in `browse-url-secondary-browser-function'."
1641 (:global "C-c l t" #'powerthesaurus-lookup-word-dwim)) 1655 (:global "C-c l t" #'powerthesaurus-lookup-word-dwim))
1642 1656
1643(setup (:straight prism) 1657(setup (:straight prism)
1644 (:hook-into lisp-mode 1658 (dolist (mode lispy-modes)
1645 c-mode)) 1659 (add-hook (intern (format "%s-hook" mode)) #'prism-mode)))
1646 1660
1647(setup prog 1661(setup prog
1648 (:option show-paren-delay 0 1662 (:option show-paren-delay 0
@@ -1813,6 +1827,7 @@ browser defined in `browse-url-secondary-browser-function'."
1813 simple-modeline-segment-process 1827 simple-modeline-segment-process
1814 acdw-modeline/god-mode-indicator 1828 acdw-modeline/god-mode-indicator
1815 acdw-modeline/minions 1829 acdw-modeline/minions
1830 acdw-modeline/reading-mode
1816 acdw-modeline/narrowed 1831 acdw-modeline/narrowed
1817 acdw-modeline/major-mode))) 1832 acdw-modeline/major-mode)))
1818 1833
diff --git a/lisp/acdw-irc.el b/lisp/acdw-irc.el index 3755441..b4b75ec 100644 --- a/lisp/acdw-irc.el +++ b/lisp/acdw-irc.el
@@ -45,18 +45,6 @@ Stolen from s.el."
45 (setq num (1- num))) 45 (setq num (1- num)))
46 (apply 'concat ss)))) 46 (apply 'concat ss))))
47 47
48(if (fboundp 's-truncate)
49 (defalias 'truncate-string 's-truncate)
50 (defun truncate-string (len s &optional ellipsis)
51 "If STR is longer than LEN, cut it down and add ELLIPSIS to the end.
52When not specified, ELLIPSIS defaults to '...'."
53 (declare (pure t) (side-effect-free t))
54 (unless ellipsis
55 (setq ellipsis "..."))
56 (if (> (length s) len)
57 (format "%s%s" (substring s 0 (- len (length ellipsis))) ellipsis)
58 s)))
59
60 48
61;;; IRC stuff 49;;; IRC stuff
62 50
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 5aa0a18..6e5afb8 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -33,12 +33,16 @@ Otherwise, cdr should be a function that takes two points (see `count-words')."
33 33
34(defun acdw-modeline/buffer-name () ; gonsie 34(defun acdw-modeline/buffer-name () ; gonsie
35 "Display the buffer name in a face reflecting its modified status." 35 "Display the buffer name in a face reflecting its modified status."
36 (propertize " %b " 36 (propertize (concat " "
37 (truncate-string (/ (window-total-width) 2)
38 (buffer-name) "~")
39 " ")
37 'face 40 'face
38 (if (buffer-modified-p) 41 (if (buffer-modified-p)
39 'font-lock-warning-face 42 'font-lock-warning-face
40 'font-lock-type-face) 43 'font-lock-type-face)
41 'help-echo (buffer-file-name))) 44 'help-echo (or (buffer-file-name)
45 (buffer-name))))
42 46
43(defun acdw-modeline/erc () 47(defun acdw-modeline/erc ()
44 "ERC indicator for the modeline." 48 "ERC indicator for the modeline."
@@ -151,6 +155,10 @@ is, if point < mark."
151 (region-bounds)))) 155 (region-bounds))))
152 'font-lock-face 'font-lock-variable-name-face)))) 156 'font-lock-face 'font-lock-variable-name-face))))
153 157
158(defun acdw-modeline/reading-mode ()
159 "Display an indicator if currently in reading mode, mine or EWW's."
160 (concat (if reading-mode "R" "") (if eww-readable-p "w" "")))
161
154(defun acdw-modeline/text-scale () 162(defun acdw-modeline/text-scale ()
155 "Display the text scaling from the modeline, if scaled." 163 "Display the text scaling from the modeline, if scaled."
156 ;; adapted from https://github.com/seagle0128/doom-modeline 164 ;; adapted from https://github.com/seagle0128/doom-modeline
diff --git a/lisp/acdw.el b/lisp/acdw.el index 91381da..0790f2e 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -54,6 +54,16 @@ ARG). When called with multiple arguments or a list, it returns
54;; I don't prefix these because ... reasons. Honestly I probably should prefix 54;; I don't prefix these because ... reasons. Honestly I probably should prefix
55;; them. 55;; them.
56 56
57(defun truncate-string (len str &optional ellipsis)
58 "If STR is longer than LEN, cut it down and add ELLIPSIS to the end.
59When not specified, ELLIPSIS defaults to '...'."
60 (declare (pure t) (side-effect-free t))
61 (unless ellipsis
62 (setq ellipsis "..."))
63 (if (> (length str) len)
64 (format "%s%s" (substring str 0 (- len (length ellipsis))) ellipsis)
65 str))
66
57;; Why isn't this a thing??? 67;; Why isn't this a thing???
58(defmacro fbound-and-true-p (func) 68(defmacro fbound-and-true-p (func)
59 "Return the value of function FUNC if it is bound, else nil." 69 "Return the value of function FUNC if it is bound, else nil."
@@ -366,10 +376,15 @@ first."
366 (goto-char (point-min)) 376 (goto-char (point-min))
367 (kill-line) 377 (kill-line)
368 (insert extracted-heading)) 378 (insert extracted-heading))
369 (replace-regexp org-property-drawer-re "") ;Delete properties 379 ;; Delete property drawers
370 (replace-regexp org-logbook-drawer-re "") ;Delete logbook 380 (replace-regexp org-property-drawer-re "")
381 ;; Delete logbook drawers
382 (replace-regexp org-logbook-drawer-re "")
383 ;; Replace list items with their contents, paragraphed
371 (replace-regexp org-list-full-item-re " 384 (replace-regexp org-list-full-item-re "
372\4") 385\4")
386 ;; Delete comment lines
387 (replace-regexp (concat org-comment-regexp ".*$") "")
373 ;; Re-fill text for clipboard 388 ;; Re-fill text for clipboard
374 (unfill-region (point-min) (point-max)) 389 (unfill-region (point-min) (point-max))
375 (flush-lines "^$" (point-min) (point-max))) 390 (flush-lines "^$" (point-min) (point-max)))
@@ -626,12 +641,28 @@ This function is internal. Use `acdw/make-password-fetcher' instead."
626 (setq-local blink-matching-paren nil 641 (setq-local blink-matching-paren nil
627 show-paren-mode nil))) 642 show-paren-mode nil)))
628 643
629;;; uh 644
630(defun 💩 (n) 645;;; 💩
631 "💩 x N" 646(defun 💩 (&optional n)
647 "💩 x N."
632 (interactive "p") 648 (interactive "p")
633 (dotimes (or n 1) 649 (let ((n (or n 1)))
634 (insert "💩"))) 650 (while (> n 0)
651 (insert "💩")
652 (setq n (1- n)))))
653
654
655;;; Fat finger solutions
656(defun acdw/fat-finger-exit (&optional prefix)
657 "Delete a frame, or kill Emacs with confirmation.
658When called with PREFIX, just kill Emacs without confirmation."
659 (interactive "P")
660 (if (or prefix
661 (and (= 1 (length (frame-list)))
662 (yes-or-no-p "This is the last frame! Wanna quit?")))
663 (kill-emacs)
664 (ignore-errors
665 (delete-frame))))
635 666
636(provide 'acdw) 667(provide 'acdw)
637;;; acdw.el ends here 668;;; acdw.el ends here