diff options
-rw-r--r-- | init.el | 115 |
1 files changed, 75 insertions, 40 deletions
diff --git a/init.el b/init.el index 5a9d9e9..edbc99c 100644 --- a/init.el +++ b/init.el | |||
@@ -291,6 +291,8 @@ package. This macro is not repeatable." | |||
291 | eval-expression-print-level nil | 291 | eval-expression-print-level nil |
292 | lisp-indent-function #'lisp-indent-function) | 292 | lisp-indent-function #'lisp-indent-function) |
293 | 293 | ||
294 | (add-hook 'emacs-lisp-mode-hook #'checkdoc-minor-mode) | ||
295 | |||
294 | (add-hook 'emacs-lisp-mode-hook | 296 | (add-hook 'emacs-lisp-mode-hook |
295 | (defun emacs-lisp@enforce-lexical-binding () | 297 | (defun emacs-lisp@enforce-lexical-binding () |
296 | (setq-local lexical-binding t))) | 298 | (setq-local lexical-binding t))) |
@@ -769,11 +771,12 @@ like a dumbass." | |||
769 | (setup scratch | 771 | (setup scratch |
770 | (:option inhibit-startup-screen t | 772 | (:option inhibit-startup-screen t |
771 | initial-buffer-choice t | 773 | initial-buffer-choice t |
772 | initial-scratch-message (concat ";; Howdy, " | 774 | initial-scratch-message "" |
773 | (nth 0 (split-string | 775 | ;; (concat ";; Howdy, " |
774 | user-full-name)) | 776 | ;; (nth 0 (split-string |
775 | "! " | 777 | ;; user-full-name)) |
776 | "Welcome to GNU Emacs.\n\n") | 778 | ;; "! " |
779 | ;; "Welcome to GNU Emacs.\n\n") | ||
777 | initial-major-mode 'emacs-lisp-mode) | 780 | initial-major-mode 'emacs-lisp-mode) |
778 | 781 | ||
779 | (add-hook 'kill-buffer-query-functions | 782 | (add-hook 'kill-buffer-query-functions |
@@ -1069,33 +1072,6 @@ like a dumbass." | |||
1069 | (autoload 'dired-async--modeline-mode "dired-async.el" nil t) | 1072 | (autoload 'dired-async--modeline-mode "dired-async.el" nil t) |
1070 | (dired-async--modeline-mode -1)))) | 1073 | (dired-async--modeline-mode -1)))) |
1071 | 1074 | ||
1072 | (setup (:straight ace-link) | ||
1073 | (ace-link-setup-default) | ||
1074 | |||
1075 | ;; I use C-o here, even though it's usually `open-line', because it still | ||
1076 | ;; matches the 'o' logic given by abo-abo (it's got the Open mnemonic and | ||
1077 | ;; it's close to 'l'), and because I've given `open-line' to M-l --- I don't | ||
1078 | ;; need `downcase-word' much, and when I do, I can use `downcase-dwim', bound | ||
1079 | ;; to C-c l. | ||
1080 | (let ((key (kbd "C-o"))) | ||
1081 | (with-eval-after-load 'erc | ||
1082 | (autoload 'org-element-lineage "org-element") | ||
1083 | (define-key erc-mode-map key #'ace-link)) | ||
1084 | (with-eval-after-load 'org | ||
1085 | (define-key org-mode-map key #'ace-link-org)) | ||
1086 | (with-eval-after-load 'gnus | ||
1087 | (define-key gnus-summary-mode-map key #'ace-link-gnus) | ||
1088 | (define-key gnus-article-mode-map key #'ace-link-gnus)) | ||
1089 | (with-eval-after-load 'ert | ||
1090 | (define-key ert-results-mode-map "o" #'ace-link-help)) | ||
1091 | (with-eval-after-load 'mastodon | ||
1092 | (define-key mastodon-mode-map "o" #'ace-link-addr)) | ||
1093 | (with-eval-after-load 'circe | ||
1094 | (define-key circe-channel-mode-map (kbd "C-o") #'ace-link-addr)) | ||
1095 | ;; And still everything else | ||
1096 | (setq ace-link-fallback-function #'ace-link-addr) | ||
1097 | (global-set-key key #'ace-link))) | ||
1098 | |||
1099 | (setup (:straight alert) | 1075 | (setup (:straight alert) |
1100 | (:option alert-default-style (acdw/system | 1076 | (:option alert-default-style (acdw/system |
1101 | (:home 'libnotify) | 1077 | (:home 'libnotify) |
@@ -1140,6 +1116,29 @@ like a dumbass." | |||
1140 | circe-reduce-lurker-spam t | 1116 | circe-reduce-lurker-spam t |
1141 | circe-server-auto-join-default-type :after-auth) | 1117 | circe-server-auto-join-default-type :after-auth) |
1142 | 1118 | ||
1119 | (defun irc () | ||
1120 | "Connect to IRC." | ||
1121 | (interactive) | ||
1122 | (dolist (network (mapcar #'car circe-network-options)) | ||
1123 | (circe-maybe-connect network))) | ||
1124 | |||
1125 | (defun circe-network-connected-p (network) | ||
1126 | "Return non-nil if there's any Circe server-buffer whose | ||
1127 | `circe-server-netwok' is NETWORK." | ||
1128 | (catch 'return | ||
1129 | (dolist (buffer (circe-server-buffers)) | ||
1130 | (with-current-buffer buffer | ||
1131 | (if (string= network circe-server-network) | ||
1132 | (throw 'return t)))))) | ||
1133 | |||
1134 | (defun circe-maybe-connect (network) | ||
1135 | "Connect to NETWORK, but ask user for confirmation if it's | ||
1136 | already been connected to." | ||
1137 | (interactive "sNetwork: ") | ||
1138 | (if (or (not (circe-network-connected-p network)) | ||
1139 | (y-or-n-p (format "Already connected to %s, reconnect?" network))) | ||
1140 | (circe network))) | ||
1141 | |||
1143 | (add-hook 'circe-chat-mode-hook | 1142 | (add-hook 'circe-chat-mode-hook |
1144 | (defun circe-chat@setup () | 1143 | (defun circe-chat@setup () |
1145 | (lui-set-prompt | 1144 | (lui-set-prompt |
@@ -1154,6 +1153,9 @@ like a dumbass." | |||
1154 | (enable-circe-display-images) | 1153 | (enable-circe-display-images) |
1155 | (enable-circe-new-day-notifier))) | 1154 | (enable-circe-new-day-notifier))) |
1156 | 1155 | ||
1156 | (add-hook 'modus-themes-after-load-theme-hook | ||
1157 | #'circe-nick-color-reset) | ||
1158 | |||
1157 | (let ((len (number-to-string (- acdw-irc/left-margin 1 | 1159 | (let ((len (number-to-string (- acdw-irc/left-margin 1 |
1158 | (+ (length acdw-irc/pre-nick) | 1160 | (+ (length acdw-irc/pre-nick) |
1159 | (length acdw-irc/post-nick))))) | 1161 | (length acdw-irc/post-nick))))) |
@@ -1193,7 +1195,7 @@ like a dumbass." | |||
1193 | scroll-margin 0 | 1195 | scroll-margin 0 |
1194 | word-wrap t | 1196 | word-wrap t |
1195 | wrap-prefix (repeat-string | 1197 | wrap-prefix (repeat-string |
1196 | (1+ acdw-irc/left-margin) " ")) | 1198 | acdw-irc/left-margin " ")) |
1197 | ;; (enable-lui-track-bar) | 1199 | ;; (enable-lui-track-bar) |
1198 | ))) | 1200 | ))) |
1199 | 1201 | ||
@@ -1322,8 +1324,7 @@ like a dumbass." | |||
1322 | (setup (:straight crux) | 1324 | (setup (:straight crux) |
1323 | 1325 | ||
1324 | (:global "C-x o" acdw/other-window-or-switch-buffer | 1326 | (:global "C-x o" acdw/other-window-or-switch-buffer |
1325 | ;; This is about to get WILD! | 1327 | "C-o" crux-smart-open-line |
1326 | "M-l" crux-smart-open-line | ||
1327 | "M-o" crux-smart-open-line-above | 1328 | "M-o" crux-smart-open-line-above |
1328 | "C-M-\\" crux-cleanup-buffer-or-region | 1329 | "C-M-\\" crux-cleanup-buffer-or-region |
1329 | "C-x 4 t" crux-transpose-windows) | 1330 | "C-x 4 t" crux-transpose-windows) |
@@ -1355,7 +1356,7 @@ like a dumbass." | |||
1355 | 1356 | ||
1356 | (advice-add 'edit-server-make-frame :before | 1357 | (advice-add 'edit-server-make-frame :before |
1357 | (defun edit-server@set-a-variable (&rest _) | 1358 | (defun edit-server@set-a-variable (&rest _) |
1358 | (setq edit-server-frame-p t))))) | 1359 | (setq-local edit-server-frame-p t))))) |
1359 | 1360 | ||
1360 | (setup (:straight (electric-cursor | 1361 | (setup (:straight (electric-cursor |
1361 | :host github | 1362 | :host github |
@@ -1580,6 +1581,34 @@ successive invocations." | |||
1580 | (setup (:straight-if ledger-mode | 1581 | (setup (:straight-if ledger-mode |
1581 | (executable-find "ledger"))) | 1582 | (executable-find "ledger"))) |
1582 | 1583 | ||
1584 | (setup (:straight link-hint) | ||
1585 | ;; Browse web URLs with a browser with a prefix argument. | ||
1586 | (dolist (type '(gnus-w3m-image-url | ||
1587 | gnus-w3m-url | ||
1588 | markdown-link | ||
1589 | mu4e-attachment | ||
1590 | mu4e-url | ||
1591 | notmuch-hello | ||
1592 | nov-link | ||
1593 | org-link | ||
1594 | shr-url | ||
1595 | text-url | ||
1596 | w3m-link | ||
1597 | w3m-message-link)) | ||
1598 | (link-hint-define-type type | ||
1599 | :open-secondary browse-url-secondary-browser-function)) | ||
1600 | |||
1601 | (defun acdw/link-hint-open-link (arg) | ||
1602 | "Open a link using `link-hint-open-link', but like `browse-url-at-point'. | ||
1603 | That is, a prefix argument (\\[universal-argument]) will open the | ||
1604 | browser defined in `browse-url-secondary-browser-function'." | ||
1605 | (interactive "P") | ||
1606 | (avy-with link-hint-open-link | ||
1607 | (link-hint--one (if arg :open-secondary :open)))) | ||
1608 | |||
1609 | (:global "C-c C-o" acdw/link-hint-open-link | ||
1610 | "C-c o" acdw/link-hint-open-link)) | ||
1611 | |||
1583 | (setup (:straight lua-mode) | 1612 | (setup (:straight lua-mode) |
1584 | (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))) | 1613 | (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))) |
1585 | 1614 | ||
@@ -1809,7 +1838,12 @@ successive invocations." | |||
1809 | (setup (:straight persistent-scratch) | 1838 | (setup (:straight persistent-scratch) |
1810 | (:option persistent-scratch-backup-directory (acdw/dir "scratch" t) | 1839 | (:option persistent-scratch-backup-directory (acdw/dir "scratch" t) |
1811 | persistent-scratch-keep-n-newest-backups 12) | 1840 | persistent-scratch-keep-n-newest-backups 12) |
1812 | (persistent-scratch-setup-default)) | 1841 | (persistent-scratch-setup-default) |
1842 | (mapc (lambda (buf) | ||
1843 | (with-current-buffer buf | ||
1844 | (when (funcall persistent-scratch-scratch-buffer-p-function) | ||
1845 | (persistent-scratch-mode +1)))) | ||
1846 | (buffer-list))) | ||
1813 | 1847 | ||
1814 | (setup (:straight restart-emacs) | 1848 | (setup (:straight restart-emacs) |
1815 | (defun emacs-upgrade (&optional update-packages) | 1849 | (defun emacs-upgrade (&optional update-packages) |
@@ -1824,16 +1858,17 @@ successive invocations." | |||
1824 | (setup (:straight minions)) | 1858 | (setup (:straight minions)) |
1825 | (require 'acdw-modeline) | 1859 | (require 'acdw-modeline) |
1826 | (:option | 1860 | (:option |
1827 | simple-modeline-segments '((acdw-modeline/modified | 1861 | simple-modeline-segments '(;; left |
1862 | (acdw-modeline/modified | ||
1828 | acdw-modeline/buffer-name | 1863 | acdw-modeline/buffer-name |
1829 | acdw-modeline/vc-branch | 1864 | acdw-modeline/vc-branch |
1830 | acdw-modeline/position) | 1865 | acdw-modeline/position) |
1866 | ;; right | ||
1831 | (simple-modeline-segment-misc-info | 1867 | (simple-modeline-segment-misc-info |
1832 | acdw-modeline/erc | 1868 | acdw-modeline/track |
1833 | acdw-modeline/wc | 1869 | acdw-modeline/wc |
1834 | acdw-modeline/text-scale | 1870 | acdw-modeline/text-scale |
1835 | simple-modeline-segment-process | 1871 | simple-modeline-segment-process |
1836 | acdw-modeline/track | ||
1837 | acdw-modeline/god-mode-indicator | 1872 | acdw-modeline/god-mode-indicator |
1838 | acdw-modeline/winum | 1873 | acdw-modeline/winum |
1839 | acdw-modeline/minions | 1874 | acdw-modeline/minions |