summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-05-09 20:37:17 -0500
committerCase Duckworth2022-05-09 20:37:17 -0500
commit4c4dd0e7824d4bf634923de19e14bbb9274c9408 (patch)
tree0928862fe65aa99249acf42c2168160a18088a21
parentmeh (diff)
parentFurther modeline changes (diff)
downloademacs-4c4dd0e7824d4bf634923de19e14bbb9274c9408.tar.gz
emacs-4c4dd0e7824d4bf634923de19e14bbb9274c9408.zip
Merged
-rw-r--r--early-init.el2
-rw-r--r--init.el152
-rw-r--r--lisp/+browse-url.el6
-rw-r--r--lisp/+consult.el2
-rw-r--r--lisp/+dired.el23
-rw-r--r--lisp/+init.el9
-rw-r--r--lisp/+jabber.el12
-rw-r--r--lisp/+key.el6
-rw-r--r--lisp/+modeline.el35
-rw-r--r--lisp/+org.el13
-rw-r--r--lisp/+setup.el80
-rw-r--r--lisp/+straight.el1
-rw-r--r--lisp/acdw.el23
-rw-r--r--lisp/find-script.el36
14 files changed, 250 insertions, 150 deletions
diff --git a/early-init.el b/early-init.el index d2097b3..0f729c8 100644 --- a/early-init.el +++ b/early-init.el
@@ -140,7 +140,7 @@ See `no-littering' for examples.")
140 140
141;; Setup `setup' 141;; Setup `setup'
142 142
143(add-to-list 'setup-modifier-list 'setup-wrap-to-demote-errors) 143(add-to-list 'setup-modifier-list '+setup-wrap-to-demote-errors)
144(unless (memq debug-on-error '(nil init)) 144(unless (memq debug-on-error '(nil init))
145 (define-advice setup (:around (fn head &rest args) +setup-report) 145 (define-advice setup (:around (fn head &rest args) +setup-report)
146 (+with-progress ((format "[Setup] %S..." head)) 146 (+with-progress ((format "[Setup] %S..." head))
diff --git a/init.el b/init.el index 172787c..2d907a0 100644 --- a/init.el +++ b/init.el
@@ -14,6 +14,14 @@
14;; - Be kind to yourself. 14;; - Be kind to yourself.
15;; - Make good choices. 15;; - Make good choices.
16 16
17;;; Commentary
18
19;; My init.el. There are many like it, but this one is mine.
20
21;; Ideas:
22;; [[https://emacs.stackexchange.com/questions/17278/truncate-only-certain-lines-and-use-continuation-lines-elsewhere][Truncate org-mode headings]]
23;; [[https://emacs.stackexchange.com/questions/7432/make-visual-line-mode-more-compatible-with-org-mode][another link that might be useful for truncating]]
24
17;;; Code: 25;;; Code:
18 26
19(let ((early-features `((early-init . ,(locate-user-emacs-file "early-init")) 27(let ((early-features `((early-init . ,(locate-user-emacs-file "early-init"))
@@ -104,6 +112,8 @@
104 (:with-mode Custom-mode 112 (:with-mode Custom-mode
105 (:local-set imenu-generic-expression +cus-edit-imenu-generic-expression))) 113 (:local-set imenu-generic-expression +cus-edit-imenu-generic-expression)))
106 114
115(setup (:require find-script))
116
107(setup (:require goto-addr) 117(setup (:require goto-addr)
108 (if (fboundp #'global-goto-address-mode) 118 (if (fboundp #'global-goto-address-mode)
109 (global-goto-address-mode) 119 (global-goto-address-mode)
@@ -242,17 +252,15 @@
242 (:option +browse-url-transformations `((,(rx (or "youtube.com" 252 (:option +browse-url-transformations `((,(rx (or "youtube.com"
243 "youtu.be")) 253 "youtu.be"))
244 . ,+invidious-host) 254 . ,+invidious-host)
245 ("twitter\\.com" 255 ("twitter\\.com" . "nitter.net")
246 . "nitter.net") 256 ("instagram\\.com" . "bibilogram.art")
247 ("instagram\\.com"
248 . "bibilogram.art")
249 (,(rx (or "reddit.com" 257 (,(rx (or "reddit.com"
250 "old.reddit.com")) 258 "old.reddit.com"))
251 . "teddit.net") 259 . "teddit.net")
252 ("medium\\.com" 260 ("medium\\.com" . "scribe.rip")
253 . "scribe.rip") 261 ("www\\.npr\\.org" . "text.npr.org")
254 ("www\\.npr\\.org" 262 ;;TODO: Various paste sites
255 . "text.npr.org"))) 263 ))
256 (+browse-url-transform-url-global-mode +1)) 264 (+browse-url-transform-url-global-mode +1))
257 265
258(setup calendar 266(setup calendar
@@ -294,7 +302,7 @@
294 #'lin-mode 302 #'lin-mode
295 #'+dired-dim-git-ignores) 303 #'+dired-dim-git-ignores)
296 (+with-ensure-after-init ; Necessary because jabber loads later 304 (+with-ensure-after-init ; Necessary because jabber loads later
297 (:+key "C-x C-j" #'dired-jump)) 305 (:+key "C-x C-j" #'dired-jump))
298 (dolist (refresh-after-func '(dired-do-flagged-delete)) 306 (dolist (refresh-after-func '(dired-do-flagged-delete))
299 (advice-add refresh-after-func :after #'revert-buffer)) 307 (advice-add refresh-after-func :after #'revert-buffer))
300 (with-eval-after-load 'frowny 308 (with-eval-after-load 'frowny
@@ -308,10 +316,12 @@
308 (:also-load +elisp) 316 (:also-load +elisp)
309 (:option eval-expression-print-length nil 317 (:option eval-expression-print-length nil
310 eval-expression-print-level nil) 318 eval-expression-print-level nil)
311 (:with-map (emacs-lisp-mode-map lisp-interaction-mode-map) 319 (:with-mode emacs-lisp-mode
312 (:bind "C-c C-c" #'eval-defun 320 (:hook #'checkdoc-minor-mode))
313 "C-c C-k" #'+elisp-eval-region-or-buffer 321 (:bind-into (emacs-lisp-mode-map lisp-interaction-mode-map)
314 "C-c C-z" #'ielm)) 322 "C-c C-c" #'eval-defun
323 "C-c C-k" #'+elisp-eval-region-or-buffer
324 "C-c C-z" #'ielm)
315 (advice-add #'eval-region :around #'+eval-region@pulse)) 325 (advice-add #'eval-region :around #'+eval-region@pulse))
316 326
317(setup eshell 327(setup eshell
@@ -362,7 +372,7 @@
362 ;; Bind keys 372 ;; Bind keys
363 (dolist (binding '(("C-d" . +eshell-quit-or-delete-char))) 373 (dolist (binding '(("C-d" . +eshell-quit-or-delete-char)))
364 (define-key eshell-mode-map 374 (define-key eshell-mode-map
365 (kbd (car binding)) (cdr binding))) 375 (kbd (car binding)) (cdr binding)))
366 ;; Environment variables 376 ;; Environment variables
367 (dolist (environment '(("PAGER" . "cat"))) 377 (dolist (environment '(("PAGER" . "cat")))
368 (setenv (car environment) (cdr environment))))) 378 (setenv (car environment) (cdr environment)))))
@@ -461,7 +471,8 @@
461 '(context-menu-ffap 471 '(context-menu-ffap
462 context-menu-region 472 context-menu-region
463 context-menu-undo 473 context-menu-undo
464 context-menu-dictionary)) 474 ;; context-menu-dictionary
475 ))
465 (context-menu-mode +1)) 476 (context-menu-mode +1))
466 (dolist (click '(;; Fix scrolling in the margin 477 (dolist (click '(;; Fix scrolling in the margin
467 wheel-down double-wheel-down triple-wheel-down 478 wheel-down double-wheel-down triple-wheel-down
@@ -470,9 +481,25 @@
470 (global-set-key (vector 'left-margin click) 'mwheel-scroll))) 481 (global-set-key (vector 'left-margin click) 'mwheel-scroll)))
471 482
472(setup net-utils 483(setup net-utils
484 (:needs "traceroute")
473 (:require +finger) ; fixes `finger' to use var below 485 (:require +finger) ; fixes `finger' to use var below
474 (:option finger-X.500-host-regexps '(".") ; only send username 486 (:option finger-X.500-host-regexps '(".") ; only send username
475 )) 487 )
488 (require 'transient)
489 (transient-define-prefix net-utils ()
490 "Networking utilities"
491 ["Actions"
492 ("p" "Ping" ping)
493 ("i" "Ifconfig" ifconfig)
494 ("w" "Iwconfig" iwconfig)
495 ("n" "Netstat" netstat)
496 ("a" "Arp" arp)
497 ("r" "Route" route)
498 ("h" "Nslookup host" nslookup-host)
499 ("d" "Dig" dig)
500 ("s" "Smb Client" smbclient)
501 ("t" "Traceroute" traceroute)])
502 (:+key "C-z M-n" #'net-utils))
476 503
477(setup notmuch 504(setup notmuch
478 (:load-from "~/usr/share/emacs/site-lisp/") 505 (:load-from "~/usr/share/emacs/site-lisp/")
@@ -561,7 +588,7 @@
561 org-fontify-done-headline t 588 org-fontify-done-headline t
562 org-fontify-quote-and-verse-blocks t 589 org-fontify-quote-and-verse-blocks t
563 org-fontify-whole-heading-line t 590 org-fontify-whole-heading-line t
564 org-hide-emphasis-markers t 591 org-hide-emphasis-markers nil
565 org-html-coding-system 'utf-8-unix 592 org-html-coding-system 'utf-8-unix
566 org-image-actual-width (list (* (window-font-width) 593 org-image-actual-width (list (* (window-font-width)
567 (- fill-column 8))) 594 (- fill-column 8)))
@@ -620,11 +647,20 @@
620 "C-c C-p" #'+org-previous-heading-widen 647 "C-c C-p" #'+org-previous-heading-widen
621 "C-c C-o" #'+org-open-at-point-dwim 648 "C-c C-o" #'+org-open-at-point-dwim
622 "`" #'+org-insert-tilde 649 "`" #'+org-insert-tilde
623 "~" #'+org-insert-backtick) 650 "~" #'+org-insert-backtick
651 "C-c C-x l" #'org-toggle-link-display
652 "C-c C-x m" (lambda () (interactive)
653 (setq-local org-hide-emphasis-markers
654 (not org-hide-emphasis-markers))
655 (font-lock-update))
656 "C-c C-x r" #'+org-drawer-list-add-resource
657 "C-M-k" #'kill-paragraph
658 "C-M-t" #'transpose-paragraphs)
624 (:global [f8] #'org-clock-in 659 (:global [f8] #'org-clock-in
625 [f9] #'org-clock-out 660 [f9] #'org-clock-out
626 "C-c l" #'org-store-link) 661 "C-c l" #'org-store-link)
627 (:hook #'variable-pitch-mode 662 (:hook #'variable-pitch-mode
663 #'visual-fill-column-mode
628 #'turn-off-auto-fill 664 #'turn-off-auto-fill
629 #'org-indent-mode 665 #'org-indent-mode
630 #'prettify-symbols-mode 666 #'prettify-symbols-mode
@@ -632,6 +668,12 @@
632 (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→) 668 (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→)
633 ("SCHEDULED:" . ?↷) 669 ("SCHEDULED:" . ?↷)
634 ("CLOSED:" . ?✓)) 670 ("CLOSED:" . ?✓))
671 ;; electric-pair-pairs
672 ;; (append electric-pair-pairs
673 ;; (mapcar (lambda (emph)
674 ;; (let ((ch (string-to-char (car emph))))
675 ;; (cons ch ch)))
676 ;; org-emphasis-alist))
635 ;;+modeline-position-function #'+org-count-words-stupidly 677 ;;+modeline-position-function #'+org-count-words-stupidly
636 ) 678 )
637 (:local-hook user-save-hook #'+org-before-save@prettify-buffer) 679 (:local-hook user-save-hook #'+org-before-save@prettify-buffer)
@@ -649,6 +691,9 @@
649 (org-link-set-parameters "sms" :follow #'+org-sms-open) 691 (org-link-set-parameters "sms" :follow #'+org-sms-open)
650 (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) 692 (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal)
651 #'+org-open-html)) 693 #'+org-open-html))
694 (:face 'org-done '((t (:inherit (modus-themes-subtle-green))))
695 'org-tag '((t (:inherit (secondary-selection))))
696 'org-todo '((t (:inherit (modus-themes-subtle-red)))))
652 ;; Extra keywords 697 ;; Extra keywords
653 (font-lock-add-keywords 698 (font-lock-add-keywords
654 'org-mode 699 'org-mode
@@ -1167,10 +1212,6 @@
1167 (:hook #'visual-line-mode 1212 (:hook #'visual-line-mode
1168 #'enable-lui-track 1213 #'enable-lui-track
1169 #'visual-fill-column-mode 1214 #'visual-fill-column-mode
1170 (defun +disable-electric-pair-mode ()
1171 "Disable `electric-pair-mode' in the current buffer."
1172 (interactive)
1173 (electric-pair-local-mode -1))
1174 #'enable-lui-autopaste) 1215 #'enable-lui-autopaste)
1175 (:local-set fringes-outside-margins t 1216 (:local-set fringes-outside-margins t
1176 right-margin-width (length lui-time-stamp-format) 1217 right-margin-width (length lui-time-stamp-format)
@@ -1187,6 +1228,7 @@
1187 (setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands) 1228 (setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands)
1188 '(flat)))) 1229 '(flat))))
1189 1230
1231 (tracking-mode +1)
1190 (:with-mode tracking-mode 1232 (:with-mode tracking-mode
1191 (:option tracking-position 'before-modes) 1233 (:option tracking-position 'before-modes)
1192 (:bind "C-c C-SPC" (lambda () (interactive) 1234 (:bind "C-c C-SPC" (lambda () (interactive)
@@ -1304,19 +1346,20 @@
1304 (with-eval-after-load 'vertico-multiform 1346 (with-eval-after-load 'vertico-multiform
1305 (setf (alist-get 'consult-buffer vertico-multiform-commands) '(flat)) 1347 (setf (alist-get 'consult-buffer vertico-multiform-commands) '(flat))
1306 (dolist (buf-cmd '(consult-find 1348 (dolist (buf-cmd '(consult-find
1307 consult-yank-pop 1349 consult-flymake
1308 consult-locate 1350 consult-focus-lines
1309 consult-grep
1310 consult-git-grep 1351 consult-git-grep
1311 consult-ripgrep 1352 consult-grep
1353 consult-imenu
1354 consult-imenu-multi
1355 consult-keep-lines
1312 consult-line 1356 consult-line
1313 consult-line-multi 1357 consult-line-multi
1358 consult-locate
1314 consult-multi-occur 1359 consult-multi-occur
1315 consult-keep-lines 1360 consult-outline
1316 consult-focus-lines 1361 consult-ripgrep
1317 consult-imenu 1362 consult-yank-pop))
1318 consult-imenu-multi
1319 consult-outline))
1320 (setf (alist-get buf-cmd vertico-multiform-commands) nil))))) 1363 (setf (alist-get buf-cmd vertico-multiform-commands) nil)))))
1321 1364
1322(setup (:straight consult-dir) 1365(setup (:straight consult-dir)
@@ -1514,6 +1557,11 @@
1514 (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) 1557 (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
1515 1558
1516(setup (:straight embrace) 1559(setup (:straight embrace)
1560 (dolist (mode '(LaTeX-mode org-mode ruby-mode))
1561 (add-hook (intern (format "%s-hook" mode))
1562 (intern (format "embrace-%s-hook" mode))))
1563 (:face 'embrace-help-pair-face '((t ( :inverse-video nil
1564 :inherit font-lock-keyword-face))))
1517 (:+key "C-," #'embrace-commander)) 1565 (:+key "C-," #'embrace-commander))
1518 1566
1519(setup (:straight (ement 1567(setup (:straight (ement
@@ -1619,7 +1667,7 @@
1619(setup (:straight (forge 1667(setup (:straight (forge
1620 :host github :repo "magit/forge") 1668 :host github :repo "magit/forge")
1621 (eq system-type 'gnu/linux)) 1669 (eq system-type 'gnu/linux))
1622 (require 'forge) 1670 (:quit) ; XXX: Somehow missing compat-26
1623 (add-to-list 'forge-alist 1671 (add-to-list 'forge-alist
1624 '("tildegit.org" "tildegit.org/api/v1" "tildegit.org" 1672 '("tildegit.org" "tildegit.org/api/v1" "tildegit.org"
1625 forge-gitea-repository))) 1673 forge-gitea-repository)))
@@ -1632,6 +1680,7 @@
1632(setup (:straight (frowny 1680(setup (:straight (frowny
1633 :host github 1681 :host github
1634 :repo "duckwork/frowny.el")) 1682 :repo "duckwork/frowny.el"))
1683 (:option frowny-eyes (rx (any ":=") (opt "'") (? "-")))
1635 (global-frowny-mode +1)) 1684 (global-frowny-mode +1))
1636 1685
1637(setup (:straight gcmh) 1686(setup (:straight gcmh)
@@ -1759,9 +1808,6 @@
1759 :fork ( :host nil 1808 :fork ( :host nil
1760 :repo "https://codeberg.org/acdw/emacs-jabber"))) 1809 :repo "https://codeberg.org/acdw/emacs-jabber")))
1761 (:also-load +jabber) 1810 (:also-load +jabber)
1762 (defvar +jabber-ws-prefix 0 "Width to pad left side of chats.")
1763 (defvar +jabber-pre-prompt " \n"
1764 "String to show before a prompt.")
1765 (:option jabber-account-list '(("acdw@hmm.st")) 1811 (:option jabber-account-list '(("acdw@hmm.st"))
1766 jabber-groupchat-buffer-format "%n" 1812 jabber-groupchat-buffer-format "%n"
1767 jabber-chat-buffer-format "%n" 1813 jabber-chat-buffer-format "%n"
@@ -1770,7 +1816,7 @@
1770 jabber-muc-decorate-presence-patterns 1816 jabber-muc-decorate-presence-patterns
1771 '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") 1817 '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$")
1772 ("." . jabber-muc-presence-dim)) 1818 ("." . jabber-muc-presence-dim))
1773 jabber-muc-colorize-foreign t 1819 jabber-muc-colorize-foreign nil ; colorizing doesn't match my color theme
1774 jabber-chat-foreign-prompt-format (concat +jabber-pre-prompt 1820 jabber-chat-foreign-prompt-format (concat +jabber-pre-prompt
1775 "[%t] %n\n" 1821 "[%t] %n\n"
1776 (make-string +jabber-ws-prefix 1822 (make-string +jabber-ws-prefix
@@ -1804,7 +1850,6 @@
1804 jabber-console-mode)) 1850 jabber-console-mode))
1805 (let ((hook (intern (format "%s-hook" mode)))) 1851 (let ((hook (intern (format "%s-hook" mode))))
1806 (add-hook hook #'visual-fill-column-mode))) 1852 (add-hook hook #'visual-fill-column-mode)))
1807 (add-hook 'jabber-activity-mode-hook #'tracking-mode)
1808 (with-eval-after-load 'tracking 1853 (with-eval-after-load 'tracking
1809 (add-to-list 'tracking-ignored-buffers "discuss@conference.soprani.ca")) 1854 (add-to-list 'tracking-ignored-buffers "discuss@conference.soprani.ca"))
1810 (:with-mode jabber-chat-mode 1855 (:with-mode jabber-chat-mode
@@ -1816,7 +1861,10 @@
1816 wrap-prefix (make-string +jabber-ws-prefix ?\ ))) 1861 wrap-prefix (make-string +jabber-ws-prefix ?\ )))
1817 (:+leader "C-j" jabber-global-keymap) 1862 (:+leader "C-j" jabber-global-keymap)
1818 (advice-add 'jabber-activity-add :after #'+jabber-tracking-add) 1863 (advice-add 'jabber-activity-add :after #'+jabber-tracking-add)
1819 (advice-add 'jabber-activity-add-muc :after #'+jabber-tracking-add-muc)) 1864 (advice-add 'jabber-activity-add-muc :after #'+jabber-tracking-add-muc)
1865 ;;; Alerting hooks --- remove echo messages
1866 (remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo)
1867 (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo))
1820 1868
1821(setup (:straight (keepassxc-shim 1869(setup (:straight (keepassxc-shim
1822 :host github :repo "duckwork/keepassxc-shim.el")) 1870 :host github :repo "duckwork/keepassxc-shim.el"))
@@ -1899,6 +1947,7 @@
1899 1947
1900(setup (:straight mastodon) 1948(setup (:straight mastodon)
1901 (:option mastodon-instance-url "https://tiny.tilde.website" 1949 (:option mastodon-instance-url "https://tiny.tilde.website"
1950 mastodon-active-user "acdw"
1902 mastodon-client--token-file (.etc "mastodon.plstore") 1951 mastodon-client--token-file (.etc "mastodon.plstore")
1903 mastodon-auth-source-file (seq-some (lambda (i) 1952 mastodon-auth-source-file (seq-some (lambda (i)
1904 (when (and (stringp i) 1953 (when (and (stringp i)
@@ -1950,8 +1999,8 @@
1950 (,(intern (format "modus-themes-heading-%s" facen)) 1999 (,(intern (format "modus-themes-heading-%s" facen))
1951 fixed-pitch)) 2000 fixed-pitch))
1952 :now))))) 2001 :now)))))
1953 (:face 'modus-themes-tab-active '((t :bold nil)) 2002 (:face 'modus-themes-tab-active '((t ( :bold nil)))
1954 'modus-themes-tab-inactive '((t :italic t))) 2003 'modus-themes-tab-inactive '((t ( :italic t))))
1955 2004
1956 (define-advice modus-themes--current-theme (:around (fn &rest r)) 2005 (define-advice modus-themes--current-theme (:around (fn &rest r))
1957 "Fix a \"nil is not a Modus theme\" error." 2006 "Fix a \"nil is not a Modus theme\" error."
@@ -2027,7 +2076,7 @@
2027 (:option completion-styles '(substring orderless basic) 2076 (:option completion-styles '(substring orderless basic)
2028 completion-category-defaults nil 2077 completion-category-defaults nil
2029 completion-category-overrides 2078 completion-category-overrides
2030 '((file (styles partial-completion)) 2079 '((file (styles basic partial-completion))
2031 (command (styles +orderless-with-initialism)) 2080 (command (styles +orderless-with-initialism))
2032 (variable (styles +orderless-with-initialism)) 2081 (variable (styles +orderless-with-initialism))
2033 (symbol (styles +orderless-with-initialism))) 2082 (symbol (styles +orderless-with-initialism)))
@@ -2067,6 +2116,7 @@
2067 (local-set-key (kbd "C-c M-o") 'org-mime-org-buffer-htmlize)))) 2116 (local-set-key (kbd "C-c M-o") 'org-mime-org-buffer-htmlize))))
2068 2117
2069(setup (:straight org-modern) 2118(setup (:straight org-modern)
2119 (:quit "I think I can do most of this myself.")
2070 (:option org-modern-hide-stars nil 2120 (:option org-modern-hide-stars nil
2071 org-modern-star nil 2121 org-modern-star nil
2072 org-modern-list nil 2122 org-modern-list nil
@@ -2092,7 +2142,9 @@
2092 (org-visibility-enable-hooks)) 2142 (org-visibility-enable-hooks))
2093 2143
2094(setup (:straight orglink) 2144(setup (:straight orglink)
2095 (global-orglink-mode +1)) 2145 (:option orglink-activate-in-modes '(text-mode prog-mode))
2146 (global-orglink-mode +1)
2147 (global-goto-address-mode -1))
2096 2148
2097(setup (:straight package-lint)) 2149(setup (:straight package-lint))
2098 2150
@@ -2211,9 +2263,7 @@
2211 ",") 2263 ",")
2212 +modeline-input-method 2264 +modeline-input-method
2213 +modeline-position 2265 +modeline-position
2214 ,(+modeline-concat 2266 +modeline-major-mode
2215 '(+modeline-minions
2216 +modeline-major-mode))
2217 +modeline-file-percentage 2267 +modeline-file-percentage
2218 ))) 2268 )))
2219 (simple-modeline-mode +1)) 2269 (simple-modeline-mode +1))
@@ -2222,6 +2272,8 @@
2222 (:also-load +slack) 2272 (:also-load +slack)
2223 (:option slack-prefer-current-team t 2273 (:option slack-prefer-current-team t
2224 slack-buffer-emojify t 2274 slack-buffer-emojify t
2275 slack-thread-also-send-to-room nil
2276 slack-typing-visibility 'buffer
2225 slack-buffer-create-on-notify t 2277 slack-buffer-create-on-notify t
2226 slack-enable-wysiwyg t 2278 slack-enable-wysiwyg t
2227 slack-file-dir (xdg-user-dir "DOWNLOAD") 2279 slack-file-dir (xdg-user-dir "DOWNLOAD")
@@ -2255,9 +2307,15 @@
2255 (sophomore-enable #'narrow-to-region) 2307 (sophomore-enable #'narrow-to-region)
2256 (sophomore-disable ; These are mostly annoying commands 2308 (sophomore-disable ; These are mostly annoying commands
2257 #'view-hello-file 2309 #'view-hello-file
2258 #'describe-gnu-project) 2310 #'describe-gnu-project
2311 #'suspend-frame)
2259 (sophomore-mode +1)) 2312 (sophomore-mode +1))
2260 2313
2314(setup (:straight (spongebob-case
2315 :host github
2316 :repo "duckwork/spongebob-case.el"))
2317 (define-key +casing-map (kbd "M-s") #'spongebob-case-dwim))
2318
2261(setup (:straight ssh-config-mode) 2319(setup (:straight ssh-config-mode)
2262 (:file-match (rx "/.ssh/config" eos) 2320 (:file-match (rx "/.ssh/config" eos)
2263 (rx "/ssh" (? "d") "_config" eos)) 2321 (rx "/ssh" (? "d") "_config" eos))
@@ -2269,7 +2327,7 @@
2269(setup (:straight super-save) 2327(setup (:straight super-save)
2270 (:option auto-save-default nil 2328 (:option auto-save-default nil
2271 super-save-auto-save-when-idle t 2329 super-save-auto-save-when-idle t
2272 super-save-idle-duration 60 2330 super-save-idle-duration 30
2273 super-save-exclude '(".gpg") 2331 super-save-exclude '(".gpg")
2274 super-save-remote-files nil) 2332 super-save-remote-files nil)
2275 (auto-save-visited-mode -1) 2333 (auto-save-visited-mode -1)
diff --git a/lisp/+browse-url.el b/lisp/+browse-url.el index dbbfef2..fc479e4 100644 --- a/lisp/+browse-url.el +++ b/lisp/+browse-url.el
@@ -120,9 +120,9 @@ ARGS are ignored here, but passed on for later processing."
120 ;; along with the rest of the args, in a list to the original caller (probably 120 ;; along with the rest of the args, in a list to the original caller (probably
121 ;; `browse-url'.) 121 ;; `browse-url'.)
122 (apply 'list 122 (apply 'list
123 (cl-loop with url = (substring-no-properties 123 (cl-loop with url = (substring-no-properties
124 (if (consp url) (car url) url)) 124 (if (consp url) (car url) url))
125 for (regex . transformation) in +browse-url-transformations 125 for (regex . transformation) in +browse-url-transformations
126 if (string-match regex url) 126 if (string-match regex url)
127 return (replace-match transformation nil nil url) 127 return (replace-match transformation nil nil url)
128 ;; else 128 ;; else
diff --git a/lisp/+consult.el b/lisp/+consult.el index dc06ad5..21c2565 100644 --- a/lisp/+consult.el +++ b/lisp/+consult.el
@@ -5,7 +5,7 @@
5(defun +consult-project-root () 5(defun +consult-project-root ()
6 "Return either the current project, or the VC root, of current file." 6 "Return either the current project, or the VC root, of current file."
7 (if (and (functionp 'project-current) 7 (if (and (functionp 'project-current)
8 (project-current)) 8 (project-current))
9 (car (project-roots (project-current))) 9 (car (project-roots (project-current)))
10 (vc-root-dir))) 10 (vc-root-dir)))
11 11
diff --git a/lisp/+dired.el b/lisp/+dired.el index 9a2e01a..2e42c19 100644 --- a/lisp/+dired.el +++ b/lisp/+dired.el
@@ -2,18 +2,17 @@
2 2
3;;; Code: 3;;; Code:
4 4
5(require 'vertico) 5(with-eval-after-load 'vertico
6 6 (defun +dired-goto-file (file)
7(defun +dired-goto-file (file) 7 "ADVICE for `dired-goto-file' to make RET call `vertico-exit'."
8 "ADVICE for `dired-goto-file' to make RET call `vertico-exit'." 8 (interactive ; stolen from `dired-goto-file'
9 (interactive ; stolen from `dired-goto-file' 9 (prog1
10 (prog1 10 (list (dlet ((vertico-map (copy-keymap vertico-map)))
11 (list (dlet ((vertico-map (copy-keymap vertico-map))) 11 (define-key vertico-map (kbd "RET") #'vertico-exit)
12 (define-key vertico-map (kbd "RET") #'vertico-exit) 12 (expand-file-name (read-file-name "Goto file: "
13 (expand-file-name (read-file-name "Goto file: " 13 (dired-current-directory)))))
14 (dired-current-directory))))) 14 (push-mark)))
15 (push-mark))) 15 (dired-goto-file file)))
16 (dired-goto-file file))
17 16
18;;; [[https://www.reddit.com/r/emacs/comments/u2lf9t/weekly_tips_tricks_c_thread/i4n9aoa/?context=3][Dim files in .gitignore]] 17;;; [[https://www.reddit.com/r/emacs/comments/u2lf9t/weekly_tips_tricks_c_thread/i4n9aoa/?context=3][Dim files in .gitignore]]
19 18
diff --git a/lisp/+init.el b/lisp/+init.el index 8f999f9..a3f680b 100644 --- a/lisp/+init.el +++ b/lisp/+init.el
@@ -72,11 +72,10 @@ are sorted lexigraphically."
72 ;; otherwise, sort lexigraphically 72 ;; otherwise, sort lexigraphically
73 (t (string< s1 s2))))))))) 73 (t (string< s1 s2)))))))))
74 ;; Return to original point relative to the defun we were in 74 ;; Return to original point relative to the defun we were in
75 (goto-char (point-min)) 75 (ignore-errors (goto-char (point-min))
76 (re-search-forward current-defun-re) 76 (re-search-forward current-defun-re)
77 (beginning-of-defun) 77 (beginning-of-defun)
78 (goto-char (+ (point) defun-point)) 78 (goto-char (+ (point) defun-point)))))
79 ))
80 79
81(defun +init-sort-then-save () 80(defun +init-sort-then-save ()
82 "Sort init.el, then save it." 81 "Sort init.el, then save it."
diff --git a/lisp/+jabber.el b/lisp/+jabber.el index c5d568c..e018b0c 100644 --- a/lisp/+jabber.el +++ b/lisp/+jabber.el
@@ -10,6 +10,18 @@
10(require 'jabber) 10(require 'jabber)
11(require 'tracking) 11(require 'tracking)
12 12
13(defgroup +jabber nil
14 "Extra jabber.el customizations."
15 :group 'jabber)
16
17(defcustom +jabber-ws-prefix 0
18 "Width to pad left side of chats."
19 :type 'string)
20
21(defcustom +jabber-pre-prompt " \n"
22 "String to put before the prompt."
23 :type 'string)
24
13(defvar +jabber-tracking-show-p #'jabber-activity-show-p-default 25(defvar +jabber-tracking-show-p #'jabber-activity-show-p-default
14 "Function that checks if the given JID should be shown in the mode line. 26 "Function that checks if the given JID should be shown in the mode line.
15This does the same as `jabber-activity-show-p', but for the 27This does the same as `jabber-activity-show-p', but for the
diff --git a/lisp/+key.el b/lisp/+key.el index ad3b215..a217dad 100644 --- a/lisp/+key.el +++ b/lisp/+key.el
@@ -19,9 +19,9 @@
19 19
20;; I need to define this map before the proper mode map. 20;; I need to define this map before the proper mode map.
21(defvar +key-leader-map (let ((map (make-sparse-keymap)) 21(defvar +key-leader-map (let ((map (make-sparse-keymap))
22 (c-z (global-key-binding "\C-z"))) 22 (c-z (global-key-binding "\C-z")))
23 (define-key map "\C-z" c-z) 23 ;;(define-key map "\C-z" c-z)
24 map) 24 map)
25 "A leader keymap under the \"C-z\" bind.") 25 "A leader keymap under the \"C-z\" bind.")
26 26
27;; http://xahlee.info/emacs/emacs/emacs_menu_app_keys.html and 27;; http://xahlee.info/emacs/emacs/emacs_menu_app_keys.html and
diff --git a/lisp/+modeline.el b/lisp/+modeline.el index e5b5bc6..df9d504 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el
@@ -126,9 +126,18 @@ and appended with `truncate-string-ellipsis'."
126 (propertize ;; (+string-truncate (format-mode-line mode-name) 16) 126 (propertize ;; (+string-truncate (format-mode-line mode-name) 16)
127 (format-mode-line mode-name) 127 (format-mode-line mode-name)
128 'face 'font-lock-keyword-face 128 'face 'font-lock-keyword-face
129 'keymap mode-line-major-mode-keymap 129 'keymap (let ((map (make-sparse-keymap)))
130 'help-echo (concat (format-mode-line mode-name) 130 (bindings--define-key map [mode-line down-mouse-1]
131 " mode\nmouse-1: show menu.") 131 `(menu-item "Menu Bar" ignore
132 :filter ,(lambda (_) (mouse-menu-major-mode-map))))
133 (define-key map [mode-line mouse-2] 'describe-mode)
134 (bindings--define-key map [mode-line down-mouse-3]
135 `(menu-item "Minions" minions-minor-modes-menu))
136 map)
137 'help-echo (+concat (list (format-mode-line mode-name) " mode")
138 "mouse-1: show menu"
139 "mouse-2: describe mode"
140 "mouse-3: display minor modes")
132 'mouse-face 'mode-line-highlight))) 141 'mouse-face 'mode-line-highlight)))
133 142
134(defcustom +modeline-modified-icon-alist '((ephemeral . "*") 143(defcustom +modeline-modified-icon-alist '((ephemeral . "*")
@@ -302,9 +311,10 @@ The order of elements matters: whichever one matches first is applied."
302 311
303(defun +modeline-line-column (&optional spacer) ; adapted from `simple-modeline' 312(defun +modeline-line-column (&optional spacer) ; adapted from `simple-modeline'
304 "Display the current cursor line and column depending on modes." 313 "Display the current cursor line and column depending on modes."
305 (funcall (+modeline-concat '(+modeline-line 314 (concat (or spacer +modeline-default-spacer)
306 +modeline-column) 315 (+modeline-line "")
307 "|"))) 316 "|"
317 (+modeline-column "")))
308 318
309(defcustom +modeline-position-function nil 319(defcustom +modeline-position-function nil
310 "Function to use instead of `+modeline-position' in modeline." 320 "Function to use instead of `+modeline-position' in modeline."
@@ -312,17 +322,16 @@ The order of elements matters: whichever one matches first is applied."
312 function) 322 function)
313 :local t) 323 :local t)
314 324
315(defun +modeline-position (&optional _) 325(defun +modeline-position (&optional spacer)
316 "Display the current cursor position. 326 "Display the current cursor position.
317See `line-number-mode', `column-number-mode', and 327See `line-number-mode', `column-number-mode', and
318`file-percentage-mode'. If `+modeline-position-function' is set 328`file-percentage-mode'. If `+modeline-position-function' is set
319to a function in the current buffer, call that function instead." 329to a function in the current buffer, call that function instead."
320 (funcall (if +modeline-position-function 330 (concat (or spacer +modeline-default-spacer)
321 +modeline-position-function 331 (if +modeline-position-function
322 (+modeline-concat '(+modeline-region 332 (funcall +modeline-position-function)
323 +modeline-line-column 333 (concat (+modeline-region)
324 ;; +modeline-file-percentage 334 (+modeline-line-column)))))
325 )))))
326 335
327(defun +modeline-vc (&optional spacer) 336(defun +modeline-vc (&optional spacer)
328 "Display the version control branch of the current buffer in the modeline." 337 "Display the version control branch of the current buffer in the modeline."
diff --git a/lisp/+org.el b/lisp/+org.el index 252ee55..6075b60 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -588,19 +588,6 @@ and POST-PROCESS are passed to `org-export-to-file'."
588 ("—" "---")))) 588 ("—" "---"))))
589 (replace-match replace nil nil))))) 589 (replace-match replace nil nil)))))
590 590
591;;; Toggle org-hide-emphasis-markers
592
593(define-minor-mode +org-show-mode
594 "Show emphasis markers and full links in `org-mode'."
595 :lighter "/*/"
596 (setq org-hide-emphasis-markers (not +org-show-mode)
597 org-link-descriptive (not +org-show-mode))
598 (funcall (if +org-show-mode
599 #'remove-from-invisibility-spec
600 #'add-to-invisibility-spec)
601 '(org-link))
602 (font-lock-update))
603
604;;; go forward and backward in the tree, ~ cleanly ~ 591;;; go forward and backward in the tree, ~ cleanly ~
605;; https://stackoverflow.com/a/25201697/10756297 592;; https://stackoverflow.com/a/25201697/10756297
606 593
diff --git a/lisp/+setup.el b/lisp/+setup.el index db59223..919e312 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el
@@ -29,23 +29,37 @@
29 "Warn the user that something bad happened in `setup'." 29 "Warn the user that something bad happened in `setup'."
30 (display-warning 'setup (format message args))) 30 (display-warning 'setup (format message args)))
31 31
32(defun +setup-wrap-to-demote-errors (body name)
33 "Wrap BODY in a `with-demoted-errors' block.
34This behavior is prevented if `setup-attributes' contains the
35symbol `without-error-demotion'.
36
37This function differs from `setup-wrap-to-demote-errors' in that
38it includes the NAME of the setup form in the warning output."
39 (if (memq 'without-error-demotion setup-attributes)
40 body
41 `(with-demoted-errors ,(format "Error in setup form on line %d (%s): %%S"
42 (line-number-at-pos)
43 name)
44 ,body)))
45
32(setup-define :quit 46(setup-define :quit
33 'setup-quit 47 'setup-quit
34 :documentation "Quit the current `setup' form. 48 :documentation "Quit the current `setup' form.
35Good for commenting.") 49Good for commenting.")
36 50
37(setup-define :face 51(setup-define :face
38 (lambda (face spec) 52 (lambda (face spec)
39 `(custom-set-faces (list ,face ,spec 'now "Customized by `setup'."))) 53 `(custom-set-faces (list ,face ,spec 'now "Customized by `setup'.")))
40 :documentation "Customize FACE with SPEC using `custom-set-faces'." 54 :documentation "Customize FACE with SPEC using `custom-set-faces'."
41 :repeatable t) 55 :repeatable t)
42 56
43(setup-define :load-after 57(setup-define :load-after
44 (lambda (&rest features) 58 (lambda (&rest features)
45 (let ((body `(require ',(setup-get 'feature)))) 59 (let ((body `(require ',(setup-get 'feature))))
46 (dolist (feature (nreverse features)) 60 (dolist (feature (nreverse features))
47 (setq body `(with-eval-after-load ',feature ,body))) 61 (setq body `(with-eval-after-load ',feature ,body)))
48 body)) 62 body))
49 :documentation "Load the current feature after FEATURES.") 63 :documentation "Load the current feature after FEATURES.")
50 64
51(setup-define :load-from 65(setup-define :load-from
@@ -88,50 +102,7 @@ If PATH does not exist, abort the evaluation."
88 ',recipe) 102 ',recipe)
89 ,(setup-quit)) 103 ,(setup-quit))
90 (:success t))) 104 (:success t)))
91(defun setup--straight-handle-arg (arg var) 105 ,(setup-quit))))
92 (cond
93 ((and (boundp var) (symbol-value var)) t)
94 ((keywordp arg) (set var t))
95 ((functionp arg) (set var nil) (funcall arg))
96 ((listp arg) (set var nil) (eval arg :lexical))))
97
98(setup-define :straight
99 (lambda (recipe &rest predicates)
100 (let* ((skp (make-symbol "straight-keyword-p"))
101 (straight-use-p
102 (cl-every (lambda (f) (setup--straight-handle-arg f skp))
103 predicates))
104 (form `(unless (and ,straight-use-p
105 (condition-case e
106 (straight-use-package ',recipe)
107 (error
108 (+setup-warn ":straight error: %S"
109 ',recipe)
110 ,(setup-quit))
111 (:success t)))
112 ,(setup-quit))))
113 ;; Keyword arguments --- :quit is special and should short-circuit
114 (if (memq :quit predicates)
115 (setq form `,(setup-quit))
116 ;; Otherwise, handle the rest of them ...
117 (when-let ((after (cadr (memq :after predicates))))
118 (setq form `(with-eval-after-load ,(if (eq after t)
119 (setup-get 'feature)
120 after)
121 ,form))))
122 ;; Finally ...
123 form))
124 :documentation "Install RECIPE with `straight-use-package'.
125If PREDICATES are given, only install RECIPE if all of them return non-nil.
126The following keyword arguments are also recognized:
127- :quit --- immediately stop evaluating. Good for commenting.
128- :after FEATURE --- only install RECIPE after FEATURE is loaded.
129 If FEATURE is t, install RECIPE after the current feature."
130 :repeatable nil
131 :indent 1
132 :shorthand (lambda (sexp)
133 (let ((recipe (cadr sexp)))
134 (or (car-safe recipe) recipe)))) ,(setup-quit))))
135 ;; Keyword arguments --- :quit is special and should short-circuit 106 ;; Keyword arguments --- :quit is special and should short-circuit
136 (if (memq :quit predicates) 107 (if (memq :quit predicates)
137 (setq form `,(setup-quit)) 108 (setq form `,(setup-quit))
@@ -155,6 +126,13 @@ The following keyword arguments are also recognized:
155 (let ((recipe (cadr sexp))) 126 (let ((recipe (cadr sexp)))
156 (or (car-safe recipe) recipe))))) 127 (or (car-safe recipe) recipe)))))
157 128
129(setup-define :needs
130 (lambda (executable)
131 `(unless (executable-find ,executable)
132 ,(setup-quit)))
133 :documentation "If EXECUTABLE is not in the path, stop here."
134 :repeatable 1)
135
158 136
159;;; Redefines of `setup' forms 137;;; Redefines of `setup' forms
160 138
diff --git a/lisp/+straight.el b/lisp/+straight.el index d00ad9a..cba6c96 100644 --- a/lisp/+straight.el +++ b/lisp/+straight.el
@@ -34,6 +34,7 @@ all of them, for reasons that should be obvious.
34 34
35With a prefix argument, it also pulls the packages FROM-UPSTREAM." 35With a prefix argument, it also pulls the packages FROM-UPSTREAM."
36 (interactive "P") 36 (interactive "P")
37 (straight-pull-recipe-repositories)
37 (straight-pull-all from-upstream) 38 (straight-pull-all from-upstream)
38 (straight-rebuild-all)) 39 (straight-rebuild-all))
39 40
diff --git a/lisp/acdw.el b/lisp/acdw.el index 7ef745d..6707e76 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -138,6 +138,10 @@ active, or else the entire buffer."
138 (= (line-beginning-position) (line-end-position))) 138 (= (line-beginning-position) (line-end-position)))
139 (insert "\n"))))) 139 (insert "\n")))))
140 140
141(defcustom +open-paragraph-ignore-modes '(special-mode lui-mode comint-mode)
142 "Modes in which `+open-paragraph' makes no sense."
143 :type '(repeat function))
144
141(defun +open-paragraph (&optional arg) 145(defun +open-paragraph (&optional arg)
142 "Open a paragraph after paragraph at point. 146 "Open a paragraph after paragraph at point.
143A paragraph is defined as continguous non-empty lines of text 147A paragraph is defined as continguous non-empty lines of text
@@ -148,7 +152,7 @@ Called with prefix ARG, open a paragraph before point."
148 ;; TODO: Take an integer as ARG, allowing for skipping paragraphs up and down. 152 ;; TODO: Take an integer as ARG, allowing for skipping paragraphs up and down.
149 (interactive "*P") 153 (interactive "*P")
150 ;; TODO: add `+open-paragraph-ignore-modes' 154 ;; TODO: add `+open-paragraph-ignore-modes'
151 (unless (derived-mode-p 'special-mode 'lui-mode 'comint-mode) 155 (unless (apply #'derived-mode-p +open-paragraph-ignore-modes)
152 ;; Go to next blank line. This /isn't/ `end-of-paragraph-text' because 156 ;; Go to next blank line. This /isn't/ `end-of-paragraph-text' because
153 ;; that's weird with org, and I'm guessing other modes too. 157 ;; that's weird with org, and I'm guessing other modes too.
154 (unless (looking-at "^$") (forward-line (if arg -1 +1))) 158 (unless (looking-at "^$") (forward-line (if arg -1 +1)))
@@ -426,5 +430,22 @@ This calls `indent-rigidly' and passes ARG to it."
426 (goto-char (line-end-position))) 430 (goto-char (line-end-position)))
427 (call-interactively #'indent-rigidly)) 431 (call-interactively #'indent-rigidly))
428 432
433(defun +sort-lines (reverse beg end)
434 "Sort lines in region, ignoring leading whitespace.
435REVERSE non-nil means descending order; interactively, REVERSE is
436the prefix argument, and BEG and END are the region. The
437variable `sort-fold-case' determines whether case affects the
438sort order."
439 (interactive "P\nr")
440 (save-excursion
441 (save-restriction
442 (narrow-to-region beg end)
443 (goto-char (point-min))
444 (let ((inhibit-field-text-motion t))
445 (sort-subr reverse
446 #'forward-line
447 #'end-of-line
448 #'beginning-of-line-text)))))
449
429(provide 'acdw) 450(provide 'acdw)
430;;; acdw.el ends here 451;;; acdw.el ends here
diff --git a/lisp/find-script.el b/lisp/find-script.el new file mode 100644 index 0000000..9e3633a --- /dev/null +++ b/lisp/find-script.el
@@ -0,0 +1,36 @@
1;;; find-script.el --- Find a script in $PATH -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;; This package makes it easier to find a script to edit in $PATH. The initial
6;; `rehash-exes' is slow, but it's stored in `*exes*' as a caching mechanism.
7;; However, I'm sure it could be improved.
8
9;; In addition, `*exes*' currently contains /all/ executables in $PATH, which
10;; ... maybe only the ones stored in some text format should be shown.
11
12;;; Code:
13
14(defvar *exes* nil
15 "All the exectuables in $PATH.
16Run `rehash-exes' to refresh this variable.")
17
18(defun rehash-exes ()
19 "List all the executables in $PATH.
20Also sets `*exes*' parameter."
21 (setq *exes*
22 (cl-loop for dir in exec-path
23 append (file-expand-wildcards (concat dir "*"))
24 into exes
25 finally return exes)))
26
27;;;###autoload
28(defun find-script (script)
29 "Find a file in $PATH."
30 (interactive
31 (list (let ((exes (or *exes* (rehash-exes))))
32 (completing-read "Script> " exes nil t))))
33 (find-file script))
34
35(provide 'find-script)
36;;; find-script.el ends here