summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-09-28 10:02:16 -0500
committerCase Duckworth2021-09-28 10:02:16 -0500
commitbdb11fee694e9ff59caec849e299c5da34fc7d8a (patch)
tree2f5cdb1125d1ea76734951cf85ded23db0ec1eea
parentMove word count in modeline (diff)
parentIgnore a couplea modes with dogears-mode (diff)
downloademacs-bdb11fee694e9ff59caec849e299c5da34fc7d8a.tar.gz
emacs-bdb11fee694e9ff59caec849e299c5da34fc7d8a.zip
Merge branch 'main' of tildegit.org:acdw/emacs
-rw-r--r--init.el129
-rw-r--r--lisp/acdw-cus-edit.el2
-rw-r--r--lisp/acdw-reading.el42
-rw-r--r--lisp/acdw-setup.el7
4 files changed, 128 insertions, 52 deletions
diff --git a/init.el b/init.el index 22ebe31..11c9e71 100644 --- a/init.el +++ b/init.el
@@ -408,7 +408,9 @@ In short, DO NOT USE THIS FUNCTION!!!"
408 (:bind "b" (defun acdw/toggle-lexical-binding () 408 (:bind "b" (defun acdw/toggle-lexical-binding ()
409 "Toggle `lexical-binding' in the current buffer." 409 "Toggle `lexical-binding' in the current buffer."
410 (interactive) 410 (interactive)
411 (setq lexical-binding (not lexical-binding))))) 411 (setq lexical-binding (not lexical-binding))
412 (message "Lexical-binding is %s"
413 (if lexical-binding "on." "off.")))))
412 414
413 415
414 (:with-map case-map 416 (:with-map case-map
@@ -1261,10 +1263,14 @@ specific to most general, they are these:
1261 (crux-reopen-as-root-mode +1)) 1263 (crux-reopen-as-root-mode +1))
1262 1264
1263(setup (:straight-if (define-repeat-map 1265(setup (:straight-if (define-repeat-map
1264 :host nil 1266 :host nil
1265 :repo "https://tildegit.org/acdw/define-repeat-map.el") 1267 :repo "https://tildegit.org/acdw/define-repeat-map.el")
1266 (acdw/system :home)) 1268 (acdw/system :home))
1267 1269
1270 (require 'define-repeat-map ; just for me
1271 (acdw/dir
1272 "straight/build/define-repeat-map/define-repeat-map.el"))
1273
1268 (defun acdw/other-window-or-switch-buffer-backward () 1274 (defun acdw/other-window-or-switch-buffer-backward ()
1269 (interactive) 1275 (interactive)
1270 (setq repeat-map 'other-window-repeat-map) 1276 (setq repeat-map 'other-window-repeat-map)
@@ -1327,6 +1333,21 @@ specific to most general, they are these:
1327 (:with-map lookup-map 1333 (:with-map lookup-map
1328 (:bind "d" #'dictionary-search))) 1334 (:bind "d" #'dictionary-search)))
1329 1335
1336(setup (:straight (dogears
1337 :host github
1338 :repo "alphapapa/dogears.el"
1339 :files (:defaults
1340 (:exclude "helm-dogears.el"))))
1341 (:option (append savehist-additional-variables) 'dogears-list)
1342 (dolist (mode '(magit-status-mode
1343 elfeed-show-mode
1344 elfeed-search-mode))
1345 (:option (append dogears-ignore-modes) mode))
1346 (:global "M-g d" dogears-go
1347 "M-g M-b" dogears-back
1348 "M-g M-f" dogears-forward)
1349 (dogears-mode +1))
1350
1330(setup (:straight edit-indirect)) 1351(setup (:straight edit-indirect))
1331 1352
1332;; requires extension: 1353;; requires extension:
@@ -1341,7 +1362,8 @@ specific to most general, they are these:
1341 "tildes.net")) 1362 "tildes.net"))
1342 'markdown-mode) 1363 'markdown-mode)
1343 (cons (rx "github.com") 1364 (cons (rx "github.com")
1344 'gfm-mode))) 1365 'gfm-mode)
1366 (cons "." 'text-mode)))
1345 1367
1346 (:advise edit-server-make-frame :before 1368 (:advise edit-server-make-frame :before
1347 (defun edit-server@set-a-variable (&rest _) 1369 (defun edit-server@set-a-variable (&rest _)
@@ -1355,11 +1377,27 @@ specific to most general, they are these:
1355(setup (:straight elfeed 1377(setup (:straight elfeed
1356 elfeed-protocol) 1378 elfeed-protocol)
1357 (:option elfeed-use-curl t 1379 (:option elfeed-use-curl t
1380 elfeed-curl-extra-arguments '("--insecure")
1358 elfeed-feeds `(("fever+https://acdw@mf.acdw.net" 1381 elfeed-feeds `(("fever+https://acdw@mf.acdw.net"
1359 :api-url "https://mf.acdw.net/fever/" 1382 :api-url "https://mf.acdw.net/fever/"
1360 :password ,(acdw/make-password-fetcher 1383 :password ,(acdw/make-password-fetcher
1361 :host "mf.acdw.net")))) 1384 :host "mf.acdw.net")
1362 1385 :autotags ; do I want to use elfeed-org ?
1386 '(("r/emacs" reddit social emacs)
1387 ("protesilaos.com/codelog.xml" emacs)
1388 ("tildes.net" social)
1389 ("catandgirl.com" comics)
1390 ("qwantz.com" comics)
1391 ("emacsninja.com" emacs)
1392 ("falseknees.com" comics)
1393 ("emacslife.com" emacs)
1394 ("lisp.org" lisp programming)
1395 ("scheme.org" scheme programming)
1396 ("smbc-comics.com" comics)
1397 ("youtube.com" video)
1398 ("tilde.news" social)
1399 ("xkcd.com" comics)))))
1400 (elfeed-set-timeout 3600)
1363 (elfeed-protocol-enable) 1401 (elfeed-protocol-enable)
1364 (:advise elfeed :after 1402 (:advise elfeed :after
1365 (defun elfeed@protocol-update (&rest _) 1403 (defun elfeed@protocol-update (&rest _)
@@ -1507,15 +1545,13 @@ specific to most general, they are these:
1507 (:option flyspell-correct-interface #'flyspell-correct-completing-read 1545 (:option flyspell-correct-interface #'flyspell-correct-completing-read
1508 flyspell-correct--cr-key ";") 1546 flyspell-correct--cr-key ";")
1509 1547
1510 (defun acdw/flyspell-correct-f7 ()
1511 "Run a full spell correction on the current buffer."
1512 (interactive)
1513 (save-mark-and-excursion
1514 (flyspell-correct-move 0 :forward :rapid)))
1515
1516 (:with-feature flyspell 1548 (:with-feature flyspell
1517 (:bind "C-." #'flyspell-correct-wrapper 1549 (:bind "C-." #'flyspell-correct-wrapper
1518 "<f7>" #'acdw/flyspell-correct-f7) 1550 "<f7>" (defun acdw/flyspell-correct-f7 ()
1551 "Run a full spell correction on the current buffer."
1552 (interactive)
1553 (save-mark-and-excursion
1554 (flyspell-correct-move 0 :forward :rapid))))
1519 (:unbind "C-;" "C-," "C-." "C-M-i"))) 1555 (:unbind "C-;" "C-," "C-." "C-M-i")))
1520 1556
1521(setup (:straight-if forge 1557(setup (:straight-if forge
@@ -1568,11 +1604,9 @@ specific to most general, they are these:
1568 (with-eval-after-load 'elpher 1604 (with-eval-after-load 'elpher
1569 (require 'gemini-write))) 1605 (require 'gemini-write)))
1570 1606
1571(setup (:straight gitattributes-mode)) 1607(setup (:straight gitattributes-mode
1572 1608 gitconfig-mode
1573(setup (:straight gitconfig-mode)) 1609 gitignore-mode))
1574
1575(setup (:straight gitignore-mode))
1576 1610
1577(setup (:straight helpful) 1611(setup (:straight helpful)
1578 (:require-after 3) 1612 (:require-after 3)
@@ -1736,7 +1770,14 @@ browser defined in `browse-url-secondary-browser-function'."
1736 mastodon-tl--enable-relative-timestamps nil) 1770 mastodon-tl--enable-relative-timestamps nil)
1737 1771
1738 (:hook #'hl-line-mode 1772 (:hook #'hl-line-mode
1739 #'reading-mode)) 1773 #'reading-mode)
1774
1775 (defun mastodon-goto-toot@recenter ()
1776 "Recenter the current toot."
1777 (recenter -1))
1778
1779 (:advise mastodon-tl--goto-next-toot :after #'mastodon-goto-toot@recenter
1780 mastodon-tl--goto-prev-toot :after #'mastodon-goto-toot@recenter))
1740 1781
1741(setup (:straight (modus-themes 1782(setup (:straight (modus-themes
1742 :host gitlab 1783 :host gitlab
@@ -1947,8 +1988,10 @@ browser defined in `browse-url-secondary-browser-function'."
1947 (if transform 1988 (if transform
1948 (substring 1989 (substring
1949 cand 1990 cand
1950 (next-single-property-change 0 'consult-org--buffer cand)) 1991 (next-single-property-change
1951 (let ((m (car (get-text-property 0 'consult-org--heading cand)))) 1992 0 'consult-org--buffer cand))
1993 (let ((m (car (get-text-property
1994 0 'consult-org--heading cand))))
1952 (if (member m org-clock-history) 1995 (if (member m org-clock-history)
1953 "*Recent*" 1996 "*Recent*"
1954 (buffer-name (marker-buffer m)))))))) 1997 (buffer-name (marker-buffer m))))))))
@@ -1977,11 +2020,12 @@ the default is \"/\"."
1977 (lambda (s) (replace-regexp-in-string "[ \t]+\\'" "" s)) 2020 (lambda (s) (replace-regexp-in-string "[ \t]+\\'" "" s))
1978 (cl-loop for head in path 2021 (cl-loop for head in path
1979 for n from 0 2022 for n from 0
1980 collect (el-patch-swap 2023 collect
1981 (org-add-props 2024 (el-patch-swap
1982 head nil 'face 2025 (org-add-props
1983 (nth (% n org-n-level-faces) org-level-faces)) 2026 head nil 'face
1984 head)) 2027 (nth (% n org-n-level-faces) org-level-faces))
2028 head))
1985 separator)))) 2029 separator))))
1986 (when (> (length fpath) width) 2030 (when (> (length fpath) width)
1987 (if (< width 7) 2031 (if (< width 7)
@@ -2051,13 +2095,6 @@ the default is \"/\"."
2051 (persistent-scratch-mode +1)))) 2095 (persistent-scratch-mode +1))))
2052 (buffer-list))) 2096 (buffer-list)))
2053 2097
2054(setup (:straight-if pkgbuild-mode
2055 (executable-find "makepkg"))
2056 (:file-match "PKGBUILD"))
2057
2058(setup (:straight powerthesaurus)
2059 (:global "C-c l t" #'powerthesaurus-lookup-word-dwim))
2060
2061(setup (:straight restart-emacs) 2098(setup (:straight restart-emacs)
2062 (defun emacs-upgrade (&optional update-packages) 2099 (defun emacs-upgrade (&optional update-packages)
2063 "Pull config, upgrade packages, restart Emacs." 2100 "Pull config, upgrade packages, restart Emacs."
@@ -2066,9 +2103,11 @@ the default is \"/\"."
2066 (when update-packages 2103 (when update-packages
2067 (require 'straight-x) 2104 (require 'straight-x)
2068 (straight-x-pull-all)) 2105 (straight-x-pull-all))
2069 (restart-emacs)))(setup (:straight (shell-command+ 2106 (restart-emacs)))
2070 :host nil 2107
2071 :repo "https://git.sr.ht/~pkal/shell-command-plus")) 2108(setup (:straight (shell-command+
2109 :host nil
2110 :repo "https://git.sr.ht/~pkal/shell-command-plus"))
2072 (:option shell-command-prompt "$ ") 2111 (:option shell-command-prompt "$ ")
2073 (:with-feature dired 2112 (:with-feature dired
2074 (:bind "M-!" shell-command+)) 2113 (:bind "M-!" shell-command+))
@@ -2341,6 +2380,22 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2341 2380
2342(setup (:straight xr)) 2381(setup (:straight xr))
2343 2382
2383(setup (:straight-if ytel
2384 (executable-find "mpv"))
2385 ;; This might need to be changed depending on whether the instance goes down.
2386 (:option ytel-invidious-api-url "https://invidious.snopyta.org")
2387 (:bind "y"
2388 (defun ytel-watch () ; This could possibly use `browse-url'.
2389 "Stream video at point in mpv."
2390 (interactive)
2391 (let* ((video (ytel-get-current-video))
2392 (id (ytel-video-id video)))
2393 (start-process "ytel mpv" nil
2394 "mpv"
2395 (concat "https://www.youtube.com/watch?v=" id)
2396 "--ytdl-format=bestvideo[height<=?720]+bestaudio/best")
2397 (message "Starting streaming...")))))
2398
2344(setup (:straight zzz-to-char) 2399(setup (:straight zzz-to-char)
2345 2400
2346 (:global "M-z" 2401 (:global "M-z"
@@ -2350,5 +2405,3 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2350 (if prefix 2405 (if prefix
2351 (call-interactively #'zzz-to-char) 2406 (call-interactively #'zzz-to-char)
2352 (call-interactively #'zzz-up-to-char))))) 2407 (call-interactively #'zzz-up-to-char)))))
2353
2354;;; init.el ends here
diff --git a/lisp/acdw-cus-edit.el b/lisp/acdw-cus-edit.el index c40f137..89273f0 100644 --- a/lisp/acdw-cus-edit.el +++ b/lisp/acdw-cus-edit.el
@@ -28,5 +28,5 @@
28 1)) 28 1))
29 "Show faces and variables in `imenu'.") 29 "Show faces and variables in `imenu'.")
30 30
31(provide 'acdw/cus-edit) 31(provide 'acdw-cus-edit)
32;;; acdw-cus-edit.el ends here 32;;; acdw-cus-edit.el ends here
diff --git a/lisp/acdw-reading.el b/lisp/acdw-reading.el index 26ee5e8..e0a7f74 100644 --- a/lisp/acdw-reading.el +++ b/lisp/acdw-reading.el
@@ -11,8 +11,17 @@
11;; - Don't hurt yourself. 11;; - Don't hurt yourself.
12;; - Make good choices. 12;; - Make good choices.
13 13
14;;; Commentary:
15
16;; here is my attempt at a reading mode.
17
14;;; Code: 18;;; Code:
15 19
20(require 'olivetti)
21
22(defvar-local //indicate-empty-lines nil)
23(defvar-local //indicate-buffer-boundaries nil)
24
16;;;###autoload 25;;;###autoload
17(define-minor-mode reading-mode 26(define-minor-mode reading-mode
18 "A mode for reading." 27 "A mode for reading."
@@ -22,30 +31,37 @@
22 (if reading-mode 31 (if reading-mode
23 (progn ;; turn on 32 (progn ;; turn on
24 ;; settings 33 ;; settings
25 (setq-local orig-indicate-empty-lines indicate-empty-lines 34 (setq-local //indicate-empty-lines indicate-empty-lines
26 indicate-empty-lines nil 35 indicate-empty-lines nil
27 orig-indicate-buffer-boundaries indicate-buffer-boundaries 36 //indicate-buffer-boundaries indicate-buffer-boundaries
28 indicate-buffer-boundaries nil) 37 indicate-buffer-boundaries nil)
29 ;; disable modes 38 ;; disable modes
30 (dolist (mode '(display-fill-column-indicator-mode)) 39 (dolist (mode '(display-fill-column-indicator-mode
40 blink-cursor-mode))
31 (when (fboundp mode) 41 (when (fboundp mode)
42 (set (make-local-variable
43 (intern (format "//%s" mode)))
44 (symbol-value mode))
32 (funcall mode -1))) 45 (funcall mode -1)))
33 ;; enable modes 46 ;; enable modes
34 (dolist (mode '(olivetti-mode)) 47 (dolist (mode '(olivetti-mode))
35 (when (fboundp mode) 48 (when (fboundp mode)
49 (set (make-local-variable
50 (intern (format "//%s" mode)))
51 (symbol-value mode))
36 (funcall mode +1)))) 52 (funcall mode +1))))
37 ;; turn off 53 ;; turn off
38 ;; settings 54 ;; restore settings
39 (setq-local indicate-empty-lines orig-indicate-empty-lines 55 (setq-local indicate-empty-lines //indicate-empty-lines
40 indicate-buffer-boundaries orig-indicate-buffer-boundaries) 56 indicate-buffer-boundaries //indicate-buffer-boundaries)
41 ;; enable modes 57 ;; restore modes
42 (dolist (mode '(display-fill-column-indicator-mode)) 58 (dolist (mode '(display-fill-column-indicator-mode
43 (when (fboundp mode) 59 olivetti-mode
44 (funcall mode +1))) 60 blink-cursor-mode))
45 ;; disable modes
46 (dolist (mode '(olivetti-mode))
47 (when (fboundp mode) 61 (when (fboundp mode)
48 (funcall mode -1))))) 62 (funcall mode (if (symbol-value (intern (format "//%s" mode)))
63 +1
64 -1))))))
49 65
50(provide 'acdw-reading) 66(provide 'acdw-reading)
51;;; acdw-reading.el ends here 67;;; acdw-reading.el ends here
diff --git a/lisp/acdw-setup.el b/lisp/acdw-setup.el index cd3807d..e271faa 100644 --- a/lisp/acdw-setup.el +++ b/lisp/acdw-setup.el
@@ -11,8 +11,15 @@
11;; - Don't hurt yourself. 11;; - Don't hurt yourself.
12;; - Make good choices. 12;; - Make good choices.
13 13
14;;; Commentary:
15
16;; setup.el makes defining local macros for `setup' forms quite simple, at
17;; least to my mind. Here are some of the ones I've defined.
18
14;;; Code: 19;;; Code:
15 20
21(require 'setup)
22
16(setup-define :autoload 23(setup-define :autoload
17 (lambda (func) 24 (lambda (func)
18 (if (listp func) 25 (if (listp func)