summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el69
-rw-r--r--lisp/acdw-irc.el12
-rw-r--r--lisp/acdw-modeline.el12
-rw-r--r--lisp/acdw.el33
4 files changed, 72 insertions, 54 deletions
diff --git a/init.el b/init.el index ec5a825..4e558b8 100644 --- a/init.el +++ b/init.el
@@ -934,8 +934,19 @@ AKA, DO NOT USE THIS FUNCTION!!!"
934 (load (expand-file-name "eshell" user-emacs-directory)))))) 934 (load (expand-file-name "eshell" user-emacs-directory))))))
935 935
936(setup eww 936(setup eww
937 (defvar-local eww-readable-p nil
938 "Whether current buffer is in readable-mode.")
937 (:option eww-search-prefix "https://duckduckgo.com/html?q=" 939 (:option eww-search-prefix "https://duckduckgo.com/html?q="
938 url-privacy-level '(email agent cookies lastloc)) 940 url-privacy-level '(email agent cookies lastloc))
941
942 (defun eww@is-readable (&rest _)
943 (setq-local eww-readable-p t))
944 (defun eww@is-not-readable (&rest _)
945 (setq-local eww-readable-p nil))
946
947 (advice-add 'eww-readable :after #'eww@is-readable)
948 (advice-add 'eww-render :after #'eww@is-not-readable)
949 (advice-add 'eww-back-url :after #'eww@is-not-readable)
939 950
940 (:hook #'reading-mode)) 951 (:hook #'reading-mode))
941 952
@@ -945,29 +956,7 @@ AKA, DO NOT USE THIS FUNCTION!!!"
945 (exec-path-from-shell-initialize))) 956 (exec-path-from-shell-initialize)))
946 957
947(setup (:straight expand-region) 958(setup (:straight expand-region)
948 (:global "C-=" #'er/expand-region 959 (:global "C-=" #'er/expand-region))
949 "C-SPC"
950 (defun acdw/set-mark-or-expand-region (arg)
951 "Set mark at point and activate, jump to mark, or expand region.
952See `set-mark-command' and `expand-region'.
953
954With no prefix argument, either run `set-mark-command' on first
955invocation and `er/expand-region' on each successive invocation.
956
957With any prefix argument
958(e.g., \\[universal-argument] \\[set-mark-command]), act as with
959`set-mark-command' (i.e., pop the mark). Don't care about
960successive invocations."
961 (interactive "P")
962 (cond
963 ((or arg
964 (and set-mark-command-repeat-pop
965 (eq last-command 'pop-to-mark-command)))
966 (setq this-command 'set-mark-command)
967 (set-mark-command arg))
968 ((eq last-command 'acdw/set-mark-or-expand-region)
969 (er/expand-region 1))
970 (t (set-mark-command arg))))))
971 960
972(setup (:straight-if fennel-mode 961(setup (:straight-if fennel-mode
973 (executable-find "fennel")) 962 (executable-find "fennel"))
@@ -1057,11 +1046,18 @@ specific to most general, they are these:
1057 1046
1058(setup (:straight flyspell-correct) 1047(setup (:straight flyspell-correct)
1059 (:option flyspell-correct-interface #'flyspell-correct-completing-read 1048 (:option flyspell-correct-interface #'flyspell-correct-completing-read
1060 flyspell-correct--cr-key "`") 1049 flyspell-correct--cr-key ";")
1050
1051 (defun acdw/flyspell-correct-f7 ()
1052 "Run a full spell correction on the current buffer."
1053 (interactive)
1054 (save-mark-and-excursion
1055 (flyspell-correct-move 0 :forward :rapid)))
1056
1061 (:with-feature flyspell 1057 (:with-feature flyspell
1062 (:hook (defun flyspell@correct () 1058 (:bind "C-." #'flyspell-correct-wrapper
1063 (:bind "C-;" #'flyspell-correct-wrapper) 1059 "<f7>" #'acdw/flyspell-correct-f7)
1064 (:unbind "C-," "C-." "C-M-i"))))) 1060 (:unbind "C-," "C-." "C-M-i")))
1065 1061
1066(setup (:straight-if forge 1062(setup (:straight-if forge
1067 (acdw/system :home)) 1063 (acdw/system :home))
@@ -1349,9 +1345,11 @@ browser defined in `browse-url-secondary-browser-function'."
1349(setup (:straight markdown-mode) 1345(setup (:straight markdown-mode)
1350 (:file-match (rx ".md" eos) 1346 (:file-match (rx ".md" eos)
1351 (rx ".markdown" eos)) 1347 (rx ".markdown" eos))
1348 (:hook #'variable-pitch-mode)
1352 1349
1353 (:with-mode gfm-mode 1350 (:with-mode gfm-mode
1354 (:file-match (rx "README.md" eos))) 1351 (:file-match (rx "README.md" eos))
1352 (:hook #'variable-pitch-mode))
1355 1353
1356 (when (executable-find "markdownfmt") 1354 (when (executable-find "markdownfmt")
1357 (with-eval-after-load 'apheleia 1355 (with-eval-after-load 'apheleia
@@ -1491,10 +1489,11 @@ browser defined in `browse-url-secondary-browser-function'."
1491 (:option 1489 (:option
1492 org-adapt-indentation nil 1490 org-adapt-indentation nil
1493 org-agenda-files nil ; only until I set this up 1491 org-agenda-files nil ; only until I set this up
1494 org-catch-invisible-edits 'smart 1492 org-catch-invisible-edits 'show-and-error
1495 org-clock-clocked-in-display 'mode-line 1493 org-clock-clocked-in-display 'mode-line
1496 org-clock-string-limit 7 ; gives time and not title 1494 org-clock-string-limit 7 ; gives time and not title
1497 org-confirm-babel-evaluate nil 1495 org-confirm-babel-evaluate nil
1496 org-cycle-separator-lines 0
1498 org-directory "~/org" 1497 org-directory "~/org"
1499 org-ellipsis " …" 1498 org-ellipsis " …"
1500 org-export-coding-system 'utf-8-unix 1499 org-export-coding-system 'utf-8-unix
@@ -1510,6 +1509,9 @@ browser defined in `browse-url-secondary-browser-function'."
1510 org-html-coding-system 'utf-8-unix 1509 org-html-coding-system 'utf-8-unix
1511 org-image-actual-width '(300) 1510 org-image-actual-width '(300)
1512 org-imenu-depth 3 1511 org-imenu-depth 3
1512 org-list-demote-modify-bullet '(("-" . "+")
1513 ("+" . "*")
1514 ("*" . "-"))
1513 org-outline-path-complete-in-steps nil 1515 org-outline-path-complete-in-steps nil
1514 org-pretty-entities t 1516 org-pretty-entities t
1515 org-refile-use-outline-path 'file 1517 org-refile-use-outline-path 'file
@@ -1614,7 +1616,7 @@ browser defined in `browse-url-secondary-browser-function'."
1614 (paredit-mode +1)) 1616 (paredit-mode +1))
1615 1617
1616 (dolist (mode lispy-modes) 1618 (dolist (mode lispy-modes)
1617 (add-hook (intern (concat (symbol-name mode) "-hook")) 1619 (add-hook (intern (format "%s-hook" mode))
1618 #'paredit@setup)) 1620 #'paredit@setup))
1619 1621
1620 (:also-load eldoc) 1622 (:also-load eldoc)
@@ -1622,7 +1624,7 @@ browser defined in `browse-url-secondary-browser-function'."
1622 1624
1623(setup (:straight paren-face) 1625(setup (:straight paren-face)
1624 (dolist (mode lispy-modes) 1626 (dolist (mode lispy-modes)
1625 (add-hook (intern (concat (symbol-name mode) "-hook")) #'paren-face-mode))) 1627 (add-hook (intern (format "%s-hook" mode)) #'paren-face-mode)))
1626 1628
1627(setup (:straight-if (pdf-tools 1629(setup (:straight-if (pdf-tools
1628 :host github 1630 :host github
@@ -1652,8 +1654,8 @@ browser defined in `browse-url-secondary-browser-function'."
1652 (:global "C-c l t" #'powerthesaurus-lookup-word-dwim)) 1654 (:global "C-c l t" #'powerthesaurus-lookup-word-dwim))
1653 1655
1654(setup (:straight prism) 1656(setup (:straight prism)
1655 (:hook-into lisp-mode 1657 (dolist (mode lispy-modes)
1656 c-mode)) 1658 (add-hook (intern (format "%s-hook" mode)) #'prism-mode)))
1657 1659
1658(setup prog 1660(setup prog
1659 (:option show-paren-delay 0 1661 (:option show-paren-delay 0
@@ -1824,6 +1826,7 @@ browser defined in `browse-url-secondary-browser-function'."
1824 simple-modeline-segment-process 1826 simple-modeline-segment-process
1825 acdw-modeline/god-mode-indicator 1827 acdw-modeline/god-mode-indicator
1826 acdw-modeline/minions 1828 acdw-modeline/minions
1829 acdw-modeline/reading-mode
1827 acdw-modeline/narrowed 1830 acdw-modeline/narrowed
1828 acdw-modeline/major-mode))) 1831 acdw-modeline/major-mode)))
1829 1832
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 b8a1906..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,16 @@ 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
635 654
636;;; Fat finger solutions 655;;; Fat finger solutions
637(defun acdw/fat-finger-exit (&optional prefix) 656(defun acdw/fat-finger-exit (&optional prefix)