diff options
-rw-r--r-- | early-init.el | 2 | ||||
-rw-r--r-- | init.el | 119 | ||||
-rw-r--r-- | lisp/+browse-url.el | 6 | ||||
-rw-r--r-- | lisp/+consult.el | 2 | ||||
-rw-r--r-- | lisp/+dired.el | 23 | ||||
-rw-r--r-- | lisp/+init.el | 9 | ||||
-rw-r--r-- | lisp/+jabber.el | 12 | ||||
-rw-r--r-- | lisp/+key.el | 6 | ||||
-rw-r--r-- | lisp/+org.el | 13 | ||||
-rw-r--r-- | lisp/+setup.el | 80 | ||||
-rw-r--r-- | lisp/+straight.el | 1 | ||||
-rw-r--r-- | lisp/acdw.el | 23 | ||||
-rw-r--r-- | lisp/find-script.el | 36 |
13 files changed, 207 insertions, 125 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 b4fade6..d67f8e7 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 |
@@ -461,7 +469,8 @@ | |||
461 | '(context-menu-ffap | 469 | '(context-menu-ffap |
462 | context-menu-region | 470 | context-menu-region |
463 | context-menu-undo | 471 | context-menu-undo |
464 | context-menu-dictionary)) | 472 | ;; context-menu-dictionary |
473 | )) | ||
465 | (context-menu-mode +1)) | 474 | (context-menu-mode +1)) |
466 | (dolist (click '(;; Fix scrolling in the margin | 475 | (dolist (click '(;; Fix scrolling in the margin |
467 | wheel-down double-wheel-down triple-wheel-down | 476 | wheel-down double-wheel-down triple-wheel-down |
@@ -470,9 +479,25 @@ | |||
470 | (global-set-key (vector 'left-margin click) 'mwheel-scroll))) | 479 | (global-set-key (vector 'left-margin click) 'mwheel-scroll))) |
471 | 480 | ||
472 | (setup net-utils | 481 | (setup net-utils |
482 | (:needs "traceroute") | ||
473 | (:require +finger) ; fixes `finger' to use var below | 483 | (:require +finger) ; fixes `finger' to use var below |
474 | (:option finger-X.500-host-regexps '(".") ; only send username | 484 | (:option finger-X.500-host-regexps '(".") ; only send username |
475 | )) | 485 | ) |
486 | (require 'transient) | ||
487 | (transient-define-prefix net-utils () | ||
488 | "Networking utilities" | ||
489 | ["Actions" | ||
490 | ("p" "Ping" ping) | ||
491 | ("i" "Ifconfig" ifconfig) | ||
492 | ("w" "Iwconfig" iwconfig) | ||
493 | ("n" "Netstat" netstat) | ||
494 | ("a" "Arp" arp) | ||
495 | ("r" "Route" route) | ||
496 | ("h" "Nslookup host" nslookup-host) | ||
497 | ("d" "Dig" dig) | ||
498 | ("s" "Smb Client" smbclient) | ||
499 | ("t" "Traceroute" traceroute)]) | ||
500 | (:+key "C-z M-n" #'net-utils)) | ||
476 | 501 | ||
477 | (setup notmuch | 502 | (setup notmuch |
478 | (:load-from "~/usr/share/emacs/site-lisp/") | 503 | (:load-from "~/usr/share/emacs/site-lisp/") |
@@ -561,7 +586,7 @@ | |||
561 | org-fontify-done-headline t | 586 | org-fontify-done-headline t |
562 | org-fontify-quote-and-verse-blocks t | 587 | org-fontify-quote-and-verse-blocks t |
563 | org-fontify-whole-heading-line t | 588 | org-fontify-whole-heading-line t |
564 | org-hide-emphasis-markers t | 589 | org-hide-emphasis-markers nil |
565 | org-html-coding-system 'utf-8-unix | 590 | org-html-coding-system 'utf-8-unix |
566 | org-image-actual-width (list (* (window-font-width) | 591 | org-image-actual-width (list (* (window-font-width) |
567 | (- fill-column 8))) | 592 | (- fill-column 8))) |
@@ -620,7 +645,15 @@ | |||
620 | "C-c C-p" #'+org-previous-heading-widen | 645 | "C-c C-p" #'+org-previous-heading-widen |
621 | "C-c C-o" #'+org-open-at-point-dwim | 646 | "C-c C-o" #'+org-open-at-point-dwim |
622 | "`" #'+org-insert-tilde | 647 | "`" #'+org-insert-tilde |
623 | "~" #'+org-insert-backtick) | 648 | "~" #'+org-insert-backtick |
649 | "C-c C-x l" #'org-toggle-link-display | ||
650 | "C-c C-x m" (lambda () (interactive) | ||
651 | (setq-local org-hide-emphasis-markers | ||
652 | (not org-hide-emphasis-markers)) | ||
653 | (font-lock-update)) | ||
654 | "C-c C-x r" #'+org-drawer-list-add-resource | ||
655 | "C-M-k" #'kill-paragraph | ||
656 | "C-M-t" #'transpose-paragraphs) | ||
624 | (:global [f8] #'org-clock-in | 657 | (:global [f8] #'org-clock-in |
625 | [f9] #'org-clock-out | 658 | [f9] #'org-clock-out |
626 | "C-c l" #'org-store-link) | 659 | "C-c l" #'org-store-link) |
@@ -632,6 +665,12 @@ | |||
632 | (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→) | 665 | (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→) |
633 | ("SCHEDULED:" . ?↷) | 666 | ("SCHEDULED:" . ?↷) |
634 | ("CLOSED:" . ?✓)) | 667 | ("CLOSED:" . ?✓)) |
668 | ;; electric-pair-pairs | ||
669 | ;; (append electric-pair-pairs | ||
670 | ;; (mapcar (lambda (emph) | ||
671 | ;; (let ((ch (string-to-char (car emph)))) | ||
672 | ;; (cons ch ch))) | ||
673 | ;; org-emphasis-alist)) | ||
635 | ;;+modeline-position-function #'+org-count-words-stupidly | 674 | ;;+modeline-position-function #'+org-count-words-stupidly |
636 | ) | 675 | ) |
637 | (:local-hook user-save-hook #'+org-before-save@prettify-buffer) | 676 | (:local-hook user-save-hook #'+org-before-save@prettify-buffer) |
@@ -649,6 +688,9 @@ | |||
649 | (org-link-set-parameters "sms" :follow #'+org-sms-open) | 688 | (org-link-set-parameters "sms" :follow #'+org-sms-open) |
650 | (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) | 689 | (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) |
651 | #'+org-open-html)) | 690 | #'+org-open-html)) |
691 | (:face 'org-done '((t (:inherit (modus-themes-subtle-green)))) | ||
692 | 'org-tag '((t (:inherit (secondary-selection)))) | ||
693 | 'org-todo '((t (:inherit (modus-themes-subtle-red))))) | ||
652 | ;; Extra keywords | 694 | ;; Extra keywords |
653 | (font-lock-add-keywords | 695 | (font-lock-add-keywords |
654 | 'org-mode | 696 | 'org-mode |
@@ -1161,10 +1203,6 @@ | |||
1161 | (:hook #'visual-line-mode | 1203 | (:hook #'visual-line-mode |
1162 | #'enable-lui-track | 1204 | #'enable-lui-track |
1163 | #'visual-fill-column-mode | 1205 | #'visual-fill-column-mode |
1164 | (defun +disable-electric-pair-mode () | ||
1165 | "Disable `electric-pair-mode' in the current buffer." | ||
1166 | (interactive) | ||
1167 | (electric-pair-local-mode -1)) | ||
1168 | #'enable-lui-autopaste) | 1206 | #'enable-lui-autopaste) |
1169 | (:local-set fringes-outside-margins t | 1207 | (:local-set fringes-outside-margins t |
1170 | right-margin-width (length lui-time-stamp-format) | 1208 | right-margin-width (length lui-time-stamp-format) |
@@ -1181,6 +1219,7 @@ | |||
1181 | (setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands) | 1219 | (setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands) |
1182 | '(flat)))) | 1220 | '(flat)))) |
1183 | 1221 | ||
1222 | (tracking-mode +1) | ||
1184 | (:with-mode tracking-mode | 1223 | (:with-mode tracking-mode |
1185 | (:option tracking-position 'before-modes) | 1224 | (:option tracking-position 'before-modes) |
1186 | (:bind "C-c C-SPC" (lambda () (interactive) | 1225 | (:bind "C-c C-SPC" (lambda () (interactive) |
@@ -1298,19 +1337,20 @@ | |||
1298 | (with-eval-after-load 'vertico-multiform | 1337 | (with-eval-after-load 'vertico-multiform |
1299 | (setf (alist-get 'consult-buffer vertico-multiform-commands) '(flat)) | 1338 | (setf (alist-get 'consult-buffer vertico-multiform-commands) '(flat)) |
1300 | (dolist (buf-cmd '(consult-find | 1339 | (dolist (buf-cmd '(consult-find |
1301 | consult-yank-pop | 1340 | consult-flymake |
1302 | consult-locate | 1341 | consult-focus-lines |
1303 | consult-grep | ||
1304 | consult-git-grep | 1342 | consult-git-grep |
1305 | consult-ripgrep | 1343 | consult-grep |
1344 | consult-imenu | ||
1345 | consult-imenu-multi | ||
1346 | consult-keep-lines | ||
1306 | consult-line | 1347 | consult-line |
1307 | consult-line-multi | 1348 | consult-line-multi |
1349 | consult-locate | ||
1308 | consult-multi-occur | 1350 | consult-multi-occur |
1309 | consult-keep-lines | 1351 | consult-outline |
1310 | consult-focus-lines | 1352 | consult-ripgrep |
1311 | consult-imenu | 1353 | consult-yank-pop)) |
1312 | consult-imenu-multi | ||
1313 | consult-outline)) | ||
1314 | (setf (alist-get buf-cmd vertico-multiform-commands) nil))))) | 1354 | (setf (alist-get buf-cmd vertico-multiform-commands) nil))))) |
1315 | 1355 | ||
1316 | (setup (:straight consult-dir) | 1356 | (setup (:straight consult-dir) |
@@ -1508,6 +1548,11 @@ | |||
1508 | (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) | 1548 | (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) |
1509 | 1549 | ||
1510 | (setup (:straight embrace) | 1550 | (setup (:straight embrace) |
1551 | (dolist (mode '(LaTeX-mode org-mode ruby-mode)) | ||
1552 | (add-hook (intern (format "%s-hook" mode)) | ||
1553 | (intern (format "embrace-%s-hook" mode)))) | ||
1554 | (:face 'embrace-help-pair-face '((t ( :inverse-video nil | ||
1555 | :inherit font-lock-keyword-face)))) | ||
1511 | (:+key "C-," #'embrace-commander)) | 1556 | (:+key "C-," #'embrace-commander)) |
1512 | 1557 | ||
1513 | (setup (:straight (ement | 1558 | (setup (:straight (ement |
@@ -1613,7 +1658,7 @@ | |||
1613 | (setup (:straight (forge | 1658 | (setup (:straight (forge |
1614 | :host github :repo "magit/forge") | 1659 | :host github :repo "magit/forge") |
1615 | (eq system-type 'gnu/linux)) | 1660 | (eq system-type 'gnu/linux)) |
1616 | (require 'forge) | 1661 | (:quit) ; XXX: Somehow missing compat-26 |
1617 | (add-to-list 'forge-alist | 1662 | (add-to-list 'forge-alist |
1618 | '("tildegit.org" "tildegit.org/api/v1" "tildegit.org" | 1663 | '("tildegit.org" "tildegit.org/api/v1" "tildegit.org" |
1619 | forge-gitea-repository))) | 1664 | forge-gitea-repository))) |
@@ -1626,6 +1671,7 @@ | |||
1626 | (setup (:straight (frowny | 1671 | (setup (:straight (frowny |
1627 | :host github | 1672 | :host github |
1628 | :repo "duckwork/frowny.el")) | 1673 | :repo "duckwork/frowny.el")) |
1674 | (:option frowny-eyes (rx (any ":=") (opt "'") (? "-"))) | ||
1629 | (global-frowny-mode +1)) | 1675 | (global-frowny-mode +1)) |
1630 | 1676 | ||
1631 | (setup (:straight gcmh) | 1677 | (setup (:straight gcmh) |
@@ -1753,9 +1799,6 @@ | |||
1753 | :fork ( :host nil | 1799 | :fork ( :host nil |
1754 | :repo "https://codeberg.org/acdw/emacs-jabber"))) | 1800 | :repo "https://codeberg.org/acdw/emacs-jabber"))) |
1755 | (:also-load +jabber) | 1801 | (:also-load +jabber) |
1756 | (defvar +jabber-ws-prefix 0 "Width to pad left side of chats.") | ||
1757 | (defvar +jabber-pre-prompt "\n" | ||
1758 | "String to show before a prompt.") | ||
1759 | (:option jabber-account-list '(("acdw@hmm.st")) | 1802 | (:option jabber-account-list '(("acdw@hmm.st")) |
1760 | jabber-groupchat-buffer-format "%n" | 1803 | jabber-groupchat-buffer-format "%n" |
1761 | jabber-chat-buffer-format "%n" | 1804 | jabber-chat-buffer-format "%n" |
@@ -1764,7 +1807,7 @@ | |||
1764 | jabber-muc-decorate-presence-patterns | 1807 | jabber-muc-decorate-presence-patterns |
1765 | '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") | 1808 | '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") |
1766 | ("." . jabber-muc-presence-dim)) | 1809 | ("." . jabber-muc-presence-dim)) |
1767 | jabber-muc-colorize-foreign t | 1810 | jabber-muc-colorize-foreign nil ; colorizing doesn't match my color theme |
1768 | jabber-chat-foreign-prompt-format (concat +jabber-pre-prompt | 1811 | jabber-chat-foreign-prompt-format (concat +jabber-pre-prompt |
1769 | "[%t] %n\n" | 1812 | "[%t] %n\n" |
1770 | (make-string +jabber-ws-prefix | 1813 | (make-string +jabber-ws-prefix |
@@ -1798,7 +1841,6 @@ | |||
1798 | jabber-console-mode)) | 1841 | jabber-console-mode)) |
1799 | (let ((hook (intern (format "%s-hook" mode)))) | 1842 | (let ((hook (intern (format "%s-hook" mode)))) |
1800 | (add-hook hook #'visual-fill-column-mode))) | 1843 | (add-hook hook #'visual-fill-column-mode))) |
1801 | (add-hook 'jabber-activity-mode-hook #'tracking-mode) | ||
1802 | (with-eval-after-load 'tracking | 1844 | (with-eval-after-load 'tracking |
1803 | (add-to-list 'tracking-ignored-buffers "discuss@conference.soprani.ca")) | 1845 | (add-to-list 'tracking-ignored-buffers "discuss@conference.soprani.ca")) |
1804 | (:with-mode jabber-chat-mode | 1846 | (:with-mode jabber-chat-mode |
@@ -1893,6 +1935,7 @@ | |||
1893 | 1935 | ||
1894 | (setup (:straight mastodon) | 1936 | (setup (:straight mastodon) |
1895 | (:option mastodon-instance-url "https://tiny.tilde.website" | 1937 | (:option mastodon-instance-url "https://tiny.tilde.website" |
1938 | mastodon-active-user "acdw" | ||
1896 | mastodon-client--token-file (.etc "mastodon.plstore") | 1939 | mastodon-client--token-file (.etc "mastodon.plstore") |
1897 | mastodon-auth-source-file (seq-some (lambda (i) | 1940 | mastodon-auth-source-file (seq-some (lambda (i) |
1898 | (when (and (stringp i) | 1941 | (when (and (stringp i) |
@@ -2021,7 +2064,7 @@ | |||
2021 | (:option completion-styles '(substring orderless basic) | 2064 | (:option completion-styles '(substring orderless basic) |
2022 | completion-category-defaults nil | 2065 | completion-category-defaults nil |
2023 | completion-category-overrides | 2066 | completion-category-overrides |
2024 | '((file (styles partial-completion)) | 2067 | '((file (styles basic partial-completion)) |
2025 | (command (styles +orderless-with-initialism)) | 2068 | (command (styles +orderless-with-initialism)) |
2026 | (variable (styles +orderless-with-initialism)) | 2069 | (variable (styles +orderless-with-initialism)) |
2027 | (symbol (styles +orderless-with-initialism))) | 2070 | (symbol (styles +orderless-with-initialism))) |
@@ -2061,6 +2104,7 @@ | |||
2061 | (local-set-key (kbd "C-c M-o") 'org-mime-org-buffer-htmlize)))) | 2104 | (local-set-key (kbd "C-c M-o") 'org-mime-org-buffer-htmlize)))) |
2062 | 2105 | ||
2063 | (setup (:straight org-modern) | 2106 | (setup (:straight org-modern) |
2107 | (:quit "I think I can do most of this myself.") | ||
2064 | (:option org-modern-hide-stars nil | 2108 | (:option org-modern-hide-stars nil |
2065 | org-modern-star nil | 2109 | org-modern-star nil |
2066 | org-modern-list nil | 2110 | org-modern-list nil |
@@ -2086,7 +2130,9 @@ | |||
2086 | (org-visibility-enable-hooks)) | 2130 | (org-visibility-enable-hooks)) |
2087 | 2131 | ||
2088 | (setup (:straight orglink) | 2132 | (setup (:straight orglink) |
2089 | (global-orglink-mode +1)) | 2133 | (:option orglink-activate-in-modes '(text-mode prog-mode)) |
2134 | (global-orglink-mode +1) | ||
2135 | (global-goto-address-mode -1)) | ||
2090 | 2136 | ||
2091 | (setup (:straight package-lint)) | 2137 | (setup (:straight package-lint)) |
2092 | 2138 | ||
@@ -2216,6 +2262,8 @@ | |||
2216 | (:also-load +slack) | 2262 | (:also-load +slack) |
2217 | (:option slack-prefer-current-team t | 2263 | (:option slack-prefer-current-team t |
2218 | slack-buffer-emojify t | 2264 | slack-buffer-emojify t |
2265 | slack-thread-also-send-to-room nil | ||
2266 | slack-typing-visibility 'buffer | ||
2219 | slack-buffer-create-on-notify t | 2267 | slack-buffer-create-on-notify t |
2220 | slack-enable-wysiwyg t | 2268 | slack-enable-wysiwyg t |
2221 | slack-file-dir (xdg-user-dir "DOWNLOAD") | 2269 | slack-file-dir (xdg-user-dir "DOWNLOAD") |
@@ -2249,7 +2297,8 @@ | |||
2249 | (sophomore-enable #'narrow-to-region) | 2297 | (sophomore-enable #'narrow-to-region) |
2250 | (sophomore-disable ; These are mostly annoying commands | 2298 | (sophomore-disable ; These are mostly annoying commands |
2251 | #'view-hello-file | 2299 | #'view-hello-file |
2252 | #'describe-gnu-project) | 2300 | #'describe-gnu-project |
2301 | #'suspend-frame) | ||
2253 | (sophomore-mode +1)) | 2302 | (sophomore-mode +1)) |
2254 | 2303 | ||
2255 | (setup (:straight ssh-config-mode) | 2304 | (setup (:straight ssh-config-mode) |
@@ -2263,7 +2312,7 @@ | |||
2263 | (setup (:straight super-save) | 2312 | (setup (:straight super-save) |
2264 | (:option auto-save-default nil | 2313 | (:option auto-save-default nil |
2265 | super-save-auto-save-when-idle t | 2314 | super-save-auto-save-when-idle t |
2266 | super-save-idle-duration 60 | 2315 | super-save-idle-duration 30 |
2267 | super-save-exclude '(".gpg") | 2316 | super-save-exclude '(".gpg") |
2268 | super-save-remote-files nil) | 2317 | super-save-remote-files nil) |
2269 | (auto-save-visited-mode -1) | 2318 | (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. |
15 | This does the same as `jabber-activity-show-p', but for the | 27 | This 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/+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. | ||
34 | This behavior is prevented if `setup-attributes' contains the | ||
35 | symbol `without-error-demotion'. | ||
36 | |||
37 | This function differs from `setup-wrap-to-demote-errors' in that | ||
38 | it 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. |
35 | Good for commenting.") | 49 | Good 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'. | ||
125 | If PREDICATES are given, only install RECIPE if all of them return non-nil. | ||
126 | The 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 | ||
35 | With a prefix argument, it also pulls the packages FROM-UPSTREAM." | 35 | With 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. |
143 | A paragraph is defined as continguous non-empty lines of text | 147 | A 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. | ||
435 | REVERSE non-nil means descending order; interactively, REVERSE is | ||
436 | the prefix argument, and BEG and END are the region. The | ||
437 | variable `sort-fold-case' determines whether case affects the | ||
438 | sort 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. | ||
16 | Run `rehash-exes' to refresh this variable.") | ||
17 | |||
18 | (defun rehash-exes () | ||
19 | "List all the executables in $PATH. | ||
20 | Also 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 | ||