diff options
author | Case Duckworth | 2021-08-30 16:37:49 -0500 |
---|---|---|
committer | Case Duckworth | 2021-08-30 16:37:49 -0500 |
commit | 46d55405836a35e4a10a875307e1702d766bd704 (patch) | |
tree | b21d51d6fab0c5598ae855a1c7b6c86943660a86 | |
parent | Betterize typo-mode (diff) | |
parent | Delete commented flyspell blocks (diff) | |
download | emacs-46d55405836a35e4a10a875307e1702d766bd704.tar.gz emacs-46d55405836a35e4a10a875307e1702d766bd704.zip |
Merge branch 'main' of tildegit.org:acdw/emacs
-rw-r--r-- | init.el | 250 | ||||
-rw-r--r-- | lisp/acdw-erc.el | 39 | ||||
-rw-r--r-- | lisp/acdw-irc.el | 84 | ||||
-rw-r--r-- | lisp/acdw-modeline.el | 70 |
4 files changed, 308 insertions, 135 deletions
diff --git a/init.el b/init.el index 856c9c5..1a54c79 100644 --- a/init.el +++ b/init.el | |||
@@ -81,15 +81,31 @@ | |||
81 | browse-url-firefox-new-window-is-tab t) | 81 | browse-url-firefox-new-window-is-tab t) |
82 | 82 | ||
83 | (acdw/browse-url-set-handlers | 83 | (acdw/browse-url-set-handlers |
84 | `(("\\.jpe?g\\'" . ,(if (executable-find "feh") | 84 | (list |
85 | #'browse-url-feh | 85 | (cons (rx (seq "." (or "jpeg" "jpg" ; images |
86 | #'eww-browse-url)) | 86 | "png") |
87 | ("youtube\\.com\\|youtu\\.be" . ,(if (executable-find "mpv") | 87 | eos)) |
88 | #'browse-url-mpv | 88 | (lambda (&rest args) |
89 | #'eww-browse-url)) | 89 | (apply (if (executable-find "feh") |
90 | ("google\\.com" . browse-url-default-browser) | 90 | #'browse-url-feh |
91 | ("\\(twitter\\.com\\|t\\.co\\)" . acdw/eww-browse-twitter-url) | 91 | #'eww-browse-url) |
92 | ("." . eww-browse-url))) | 92 | args))) |
93 | (cons (rx (or "youtube.com" ; videos | ||
94 | "youtu.be" | ||
95 | (seq "." (or "mp4" | ||
96 | "gif") | ||
97 | eos))) | ||
98 | (lambda (&rest args) | ||
99 | (apply (if (executable-find "mpv") | ||
100 | #'browse-url-mpv | ||
101 | browse-url-secondary-browser-function) | ||
102 | args))) | ||
103 | (cons (rx (or "google.com" ; websites that don't work with eww | ||
104 | "reddit.com" | ||
105 | "twitter.com")) | ||
106 | browse-url-secondary-browser-function) | ||
107 | (cons "." ; everything else | ||
108 | #'eww-browse-url))) | ||
93 | 109 | ||
94 | ;; Buttonize gemini:// links. | 110 | ;; Buttonize gemini:// links. |
95 | (acdw/add-button-url-regexp-protocol "gemini")) | 111 | (acdw/add-button-url-regexp-protocol "gemini")) |
@@ -153,8 +169,7 @@ | |||
153 | ("Variables" "^\\(?:Show Value\\|Hide\\) \\([^:\n]*\\)" 1)))))) | 169 | ("Variables" "^\\(?:Show Value\\|Hide\\) \\([^:\n]*\\)" 1)))))) |
154 | 170 | ||
155 | (setup debugger | 171 | (setup debugger |
156 | (:hook visual-line-mode) | 172 | (:hook visual-line-mode)) |
157 | (:global "C-c d" toggle-debug-on-error)) | ||
158 | 173 | ||
159 | (setup dired | 174 | (setup dired |
160 | (setq-default dired-recursive-copies 'always | 175 | (setq-default dired-recursive-copies 'always |
@@ -323,6 +338,7 @@ | |||
323 | 338 | ||
324 | (:option | 339 | (:option |
325 | erc-auto-discard-away t | 340 | erc-auto-discard-away t |
341 | erc-auto-set-away t | ||
326 | erc-autoaway-idle-seconds 600 | 342 | erc-autoaway-idle-seconds 600 |
327 | erc-autoaway-message "BRB (autoaway: %i seconds)" | 343 | erc-autoaway-message "BRB (autoaway: %i seconds)" |
328 | erc-button-url-regexp browse-url-button-regexp | 344 | erc-button-url-regexp browse-url-button-regexp |
@@ -333,7 +349,7 @@ | |||
333 | erc-fill-static-center 14 | 349 | erc-fill-static-center 14 |
334 | erc-format-nick-function #'erc-format-truncate-@nick | 350 | erc-format-nick-function #'erc-format-truncate-@nick |
335 | erc-header-line-face-method #'erc/update-header-line-show-disconnected | 351 | erc-header-line-face-method #'erc/update-header-line-show-disconnected |
336 | erc-hide-list '("NICK" "MODE" "JOIN" "PART" "QUIT") | 352 | erc-hide-list '("NICK" "MODE" "JOIN" "PART" "QUIT" "AWAY") |
337 | erc-interpret-controls-p t | 353 | erc-interpret-controls-p t |
338 | erc-interpret-mirc-color t | 354 | erc-interpret-mirc-color t |
339 | erc-join-buffer 'bury | 355 | erc-join-buffer 'bury |
@@ -353,7 +369,9 @@ | |||
353 | erc-server-coding-system '(utf-8 . utf-8) | 369 | erc-server-coding-system '(utf-8 . utf-8) |
354 | erc-timestamp-intangible t | 370 | erc-timestamp-intangible t |
355 | erc-track-exclude-types (append erc-hide-list | 371 | erc-track-exclude-types (append erc-hide-list |
356 | '("AWAY" | 372 | '("AWAY" ; for some reason this triggers |
373 | ; track anyway... so it's in | ||
374 | ; `erc-hide-list' | ||
357 | "353" "324" "329" "332" "333" "477")) | 375 | "353" "324" "329" "332" "333" "477")) |
358 | erc-track-exclude-server-buffer t | 376 | erc-track-exclude-server-buffer t |
359 | erc-track-position-in-mode-line 'before-modes | 377 | erc-track-position-in-mode-line 'before-modes |
@@ -487,74 +505,6 @@ like a dumbass." | |||
487 | (define-key flyspell-mode-map | 505 | (define-key flyspell-mode-map |
488 | (kbd (car keybind)) (cdr keybind)))))) | 506 | (kbd (car keybind)) (cdr keybind)))))) |
489 | 507 | ||
490 | ;; (setup flyspell | ||
491 | ;; ;; follow the directions here: https://old.reddit.com/r/emacs/comments/dgj0ae | ||
492 | ;; ;; in short: | ||
493 | ;; ;; - download hunspell from GitHub and put in ~/usr/bin | ||
494 | ;; ;; - download LibreOffice English dictionaries and put in | ||
495 | ;; ;; ~/usr/share/hunspell | ||
496 | ;; (setq-default | ||
497 | ;; flyspell-issue-message-flag nil | ||
498 | ;; ispell-program-name "hunspell" | ||
499 | ;; ispell-dictionary "default" | ||
500 | ;; ispell-personal-dictionary "~/.hunspell_personal" | ||
501 | ;; ispell-local-dictionary-alist '(("default" | ||
502 | ;; "[[:alpha:]]" "[^[:alpha:]]" | ||
503 | ;; "[']" nil | ||
504 | ;; ("-d" "en_US") nil utf-8))) | ||
505 | |||
506 | ;; (acdw/system | ||
507 | ;; (:work (let ((dicpath (expand-file-name "~/usr/share/hunspell/"))) | ||
508 | ;; (setenv "DICPATH" dicpath)))) | ||
509 | |||
510 | ;; ;; new variable `ispell-hunspell-dictionary-alist' is defined in Emacs | ||
511 | ;; ;; If it's nil, Emacs tries to automatically set up the dictionaries. | ||
512 | ;; (when (boundp 'ispell-hunspell-dictionary-alist) | ||
513 | ;; (setq ispell-hunspell-dictionary-alist ispell-local-dictionary-alist)) | ||
514 | |||
515 | ;; (:needs ispell-program-name) ; don't proceed if not installed | ||
516 | |||
517 | ;; (unless (file-exists-p ispell-personal-dictionary) | ||
518 | ;; (write-region "" nil ispell-personal-dictionary nil 0)) | ||
519 | |||
520 | ;; (when (executable-find ispell-program-name) | ||
521 | ;; (add-hook 'text-mode-hook #'flyspell-mode) | ||
522 | ;; (add-hook 'prog-mode-hook #'flyspell-prog-mode)) | ||
523 | |||
524 | ;; (:when-loaded | ||
525 | ;; (setup (:straight flyspell-correct) | ||
526 | ;; (:with-map flyspell-mode-map | ||
527 | ;; (:bind "C-;" flyspell-correct-wrapper | ||
528 | ;; ;; Remove all other binds | ||
529 | ;; "C-," nil | ||
530 | ;; "C-." nil | ||
531 | ;; "C-M-i" nil))))) | ||
532 | |||
533 | ;; (setup flyspell | ||
534 | ;; (:option | ||
535 | ;; flyspell-issue-message-flag nil | ||
536 | ;; ispell-program-name "aspell" | ||
537 | ;; ispell-dictionary "en_US" | ||
538 | ;; ispell-personal-dictionary "~/.dictionary" | ||
539 | ;; ispell-extra-args '("--sug-mode=ultra" "--lang=en_US")) | ||
540 | |||
541 | ;; (:needs ispell-program-name) | ||
542 | |||
543 | ;; (unless (file-exists-p ispell-personal-dictionary) | ||
544 | ;; (write-region "" nil ispell-personal-dictionary nil 0)) | ||
545 | |||
546 | ;; (add-hook 'text-mode-hook #'flyspell-mode) | ||
547 | ;; (add-hook 'prog-mode-hook #'flyspell-prog-mode) | ||
548 | |||
549 | ;; (:when-loaded | ||
550 | ;; (setup (:straight flyspell-correct) | ||
551 | ;; (:with-map flyspell-mode-map | ||
552 | ;; (:bind "C-;" flyspell-correct-wrapper | ||
553 | ;; ;; Remove other binds | ||
554 | ;; "C-," nil | ||
555 | ;; "C-." nil | ||
556 | ;; "C-M-i" nil))))) | ||
557 | |||
558 | (setup frames | 508 | (setup frames |
559 | (:option frame-title-format '("%b@" | 509 | (:option frame-title-format '("%b@" |
560 | (:eval | 510 | (:eval |
@@ -609,11 +559,7 @@ like a dumbass." | |||
609 | (mode . gemini-mode) | 559 | (mode . gemini-mode) |
610 | (mode . eww-mode)))))) | 560 | (mode . eww-mode)))))) |
611 | 561 | ||
612 | (global-set-key (kbd "C-x C-b") | 562 | (global-set-key (kbd "C-x C-b") #'ibuffer) |
613 | (defun list-buffers-or-ibuffer (arg) | ||
614 | "`list-buffers', or with a prefix arg, `ibuffer'." | ||
615 | (interactive "P") | ||
616 | (if arg (ibuffer) (electric-buffer-list nil)))) | ||
617 | 563 | ||
618 | (add-hook 'ibuffer-mode-hook | 564 | (add-hook 'ibuffer-mode-hook |
619 | (defun ibuffer@filter-to-default () | 565 | (defun ibuffer@filter-to-default () |
@@ -1006,8 +952,7 @@ like a dumbass." | |||
1006 | kill-read-only-ok t | 952 | kill-read-only-ok t |
1007 | load-prefer-newer t | 953 | load-prefer-newer t |
1008 | native-comp-async-report-warnings-errors nil | 954 | native-comp-async-report-warnings-errors nil |
1009 | set-mark-command-repeat-pop t | 955 | set-mark-command-repeat-pop t) |
1010 | ) | ||
1011 | 956 | ||
1012 | (when (fboundp 'command-completion-default-include-p) | 957 | (when (fboundp 'command-completion-default-include-p) |
1013 | (setq read-extended-command-predicate | 958 | (setq read-extended-command-predicate |
@@ -1018,13 +963,24 @@ like a dumbass." | |||
1018 | "C-c c" capitalize-dwim | 963 | "C-c c" capitalize-dwim |
1019 | "C-c u" upcase-dwim | 964 | "C-c u" upcase-dwim |
1020 | "C-c l" downcase-dwim | 965 | "C-c l" downcase-dwim |
1021 | "C-c t" acdw/insert-iso-date) | 966 | "C-c d" acdw/insert-iso-date |
967 | "M-`" nil) | ||
968 | |||
969 | ;; toggle bindings | ||
970 | (defvar toggle-map (make-sparse-keymap) | ||
971 | "A keymap for toggling!") | ||
972 | (global-set-key (kbd "C-c t") toggle-map) | ||
973 | |||
974 | (:with-map toggle-map | ||
975 | (:bind "c" column-number-mode | ||
976 | "l" display-line-numbers-mode | ||
977 | "d" toggle-debug-on-error)) | ||
1022 | 978 | ||
1023 | (defalias 'forward-word-with-case 'forward-word | 979 | (defalias 'forward-word-with-case 'forward-word |
1024 | "Alias for `forward-word' for use in `case-repeat-map'.") | 980 | "Alias for `forward-word' for use in `case-repeat-map'.") |
1025 | (defalias 'backward-word-with-case 'backward-word | 981 | (defalias 'backward-word-with-case 'backward-word |
1026 | "Alias for `backward-word for use in `case-repeat-map'.") | 982 | "Alias for `backward-word for use in `case-repeat-map'.") |
1027 | 983 | ||
1028 | (defvar case-repeat-map | 984 | (defvar case-repeat-map |
1029 | (let ((map (make-sparse-keymap))) | 985 | (let ((map (make-sparse-keymap))) |
1030 | (define-key map "c" #'capitalize-word) | 986 | (define-key map "c" #'capitalize-word) |
@@ -1035,6 +991,7 @@ like a dumbass." | |||
1035 | (define-key map "b" #'backward-word-with-case) | 991 | (define-key map "b" #'backward-word-with-case) |
1036 | map) | 992 | map) |
1037 | "A map to repeat word-casing commands. For use with `repeat-mode'.") | 993 | "A map to repeat word-casing commands. For use with `repeat-mode'.") |
994 | |||
1038 | (dolist (command '(capitalize-word | 995 | (dolist (command '(capitalize-word |
1039 | capitalize-dwim | 996 | capitalize-dwim |
1040 | upcase-word | 997 | upcase-word |
@@ -1092,10 +1049,17 @@ like a dumbass." | |||
1092 | (define-key gnus-article-mode-map key #'ace-link-gnus)) | 1049 | (define-key gnus-article-mode-map key #'ace-link-gnus)) |
1093 | (with-eval-after-load 'ert | 1050 | (with-eval-after-load 'ert |
1094 | (define-key ert-results-mode-map "o" #'ace-link-help)) | 1051 | (define-key ert-results-mode-map "o" #'ace-link-help)) |
1052 | (with-eval-after-load 'mastodon | ||
1053 | (define-key mastodon-mode-map "o" #'ace-link-addr)) | ||
1095 | ;; And still everything else | 1054 | ;; And still everything else |
1096 | (setq ace-link-fallback-function #'ace-link-addr) | 1055 | (setq ace-link-fallback-function #'ace-link-addr) |
1097 | (global-set-key key #'ace-link))) | 1056 | (global-set-key key #'ace-link))) |
1098 | 1057 | ||
1058 | (setup (:straight alert) | ||
1059 | (:option alert-default-style (acdw/system | ||
1060 | (:home 'libnotify) | ||
1061 | (_ 'message)))) | ||
1062 | |||
1099 | (setup (:straight avy) | 1063 | (setup (:straight avy) |
1100 | (:global "C-'" avy-goto-char-timer | 1064 | (:global "C-'" avy-goto-char-timer |
1101 | "M-g f" avy-goto-line | 1065 | "M-g f" avy-goto-line |
@@ -1108,6 +1072,74 @@ like a dumbass." | |||
1108 | (setup (:straight (beginend)) | 1072 | (setup (:straight (beginend)) |
1109 | (beginend-global-mode +1)) | 1073 | (beginend-global-mode +1)) |
1110 | 1074 | ||
1075 | (setup (:straight circe) | ||
1076 | (require 'circe) | ||
1077 | (require 'acdw-irc) | ||
1078 | |||
1079 | (setq acdw-irc/post-my-nick "-> ") | ||
1080 | |||
1081 | (setq circe-default-part-message "See You, Space Cowpokes . . ." | ||
1082 | circe-highlight-nick-type 'all | ||
1083 | ;; circe-network-options in private.el | ||
1084 | circe-reduce-lurker-spam t | ||
1085 | circe-server-auto-join-default-type :after-auth) | ||
1086 | |||
1087 | (add-hook 'circe-chat-mode-hook | ||
1088 | (defun circe-chat@setup () | ||
1089 | (lui-set-prompt | ||
1090 | (concat (propertize (acdw-irc/margin-format (buffer-name) | ||
1091 | "" | ||
1092 | ">") | ||
1093 | 'face 'circe-prompt-face | ||
1094 | 'read-only t 'intangible t | ||
1095 | 'cursor-intangible t) | ||
1096 | " ")) | ||
1097 | (enable-circe-color-nicks) | ||
1098 | (enable-circe-display-images) | ||
1099 | (enable-circe-new-day-notifier))) | ||
1100 | |||
1101 | (let ((len (number-to-string (- acdw-irc/left-margin 1 | ||
1102 | (+ (length acdw-irc/pre-nick) | ||
1103 | (length acdw-irc/post-nick))))) | ||
1104 | (my-len (number-to-string (- acdw-irc/left-margin 1 | ||
1105 | (+ (length acdw-irc/pre-my-nick) | ||
1106 | (length acdw-irc/post-my-nick)))))) | ||
1107 | (setq circe-format-say (concat acdw-irc/pre-nick | ||
1108 | "{nick:" len "." len "s} " | ||
1109 | acdw-irc/post-nick | ||
1110 | "{body}") | ||
1111 | circe-format-self-say (concat acdw-irc/pre-my-nick | ||
1112 | "{nick:" my-len "." my-len "s} " | ||
1113 | acdw-irc/post-my-nick | ||
1114 | "{body}") | ||
1115 | circe-format-action (concat "*" | ||
1116 | (repeat-string | ||
1117 | (- acdw-irc/left-margin 3) | ||
1118 | " ") | ||
1119 | "* {nick} {body}") | ||
1120 | circe-format-self-action (concat "-*" | ||
1121 | (repeat-string | ||
1122 | (- acdw-irc/left-margin 4) | ||
1123 | " ") | ||
1124 | "* {nick} {body}") | ||
1125 | lui-fill-type (concat | ||
1126 | (repeat-string (- acdw-irc/left-margin 2) | ||
1127 | " ") | ||
1128 | " "))) | ||
1129 | |||
1130 | (setq lui-time-stamp-position 'right-margin | ||
1131 | lui-time-stamp-format "%H:%M") | ||
1132 | (add-hook 'lui-mode-hook | ||
1133 | (defun lui-mode@setup () | ||
1134 | (setq-local fringes-outside-margins t | ||
1135 | lui-track-bar-behavior 'before-switch-to-buffer | ||
1136 | right-margin-width 5 | ||
1137 | scroll-margin 0 | ||
1138 | word-wrap t | ||
1139 | wrap-prefix (repeat-string | ||
1140 | (1+ acdw-irc/left-margin) " ")) | ||
1141 | (enable-lui-track-bar)))) | ||
1142 | |||
1111 | (setup (:straight (consult | 1143 | (setup (:straight (consult |
1112 | :host github | 1144 | :host github |
1113 | :repo "minad/consult")) | 1145 | :repo "minad/consult")) |
@@ -1263,7 +1295,10 @@ like a dumbass." | |||
1263 | (when (and (daemonp) | 1295 | (when (and (daemonp) |
1264 | (require 'edit-server nil :noerror)) | 1296 | (require 'edit-server nil :noerror)) |
1265 | (edit-server-start) | 1297 | (edit-server-start) |
1266 | (add-hook 'edit-server-done-hook #'unfill-buffer))) | 1298 | |
1299 | (advice-add 'edit-server-make-frame :before | ||
1300 | (defun edit-server@set-a-variable (&rest _) | ||
1301 | (setq edit-server-frame-p t))))) | ||
1267 | 1302 | ||
1268 | (setup (:straight (electric-cursor | 1303 | (setup (:straight (electric-cursor |
1269 | :host github | 1304 | :host github |
@@ -1420,7 +1455,7 @@ successive invocations." | |||
1420 | 1455 | ||
1421 | (setup (:straight helpful) | 1456 | (setup (:straight helpful) |
1422 | (:option helpful-max-buffers 5 | 1457 | (:option helpful-max-buffers 5 |
1423 | helpful-switch-buffer-function #'pop-to-buffer | 1458 | ;; helpful-switch-buffer-function #'pop-to-buffer |
1424 | ;; helpful-switch-buffer-function | 1459 | ;; helpful-switch-buffer-function |
1425 | ;; (lambda (buf) | 1460 | ;; (lambda (buf) |
1426 | ;; (pop-to-buffer buf | 1461 | ;; (pop-to-buffer buf |
@@ -1434,13 +1469,14 @@ successive invocations." | |||
1434 | "<help> k" helpful-key | 1469 | "<help> k" helpful-key |
1435 | "<help> o" helpful-symbol | 1470 | "<help> o" helpful-symbol |
1436 | "C-c C-d" helpful-at-point) | 1471 | "C-c C-d" helpful-at-point) |
1437 | (with-eval-after-load 'helpful | 1472 | ;; (with-eval-after-load 'helpful |
1438 | (define-key helpful-mode-map "q" | 1473 | ;; (define-key helpful-mode-map "q" |
1439 | (defun helpful-mode|quit () | 1474 | ;; (defun helpful-mode|quit () |
1440 | (interactive) | 1475 | ;; (interactive) |
1441 | (bury-buffer) | 1476 | ;; (bury-buffer) |
1442 | (unless (window-parameter (frame-selected-window) 'no-other-window) | 1477 | ;; (unless (window-parameter (frame-selected-window) 'no-other-window) |
1443 | (delete-window)))))) | 1478 | ;; (delete-window))))) |
1479 | ) | ||
1444 | 1480 | ||
1445 | (setup (:straight iscroll) | 1481 | (setup (:straight iscroll) |
1446 | (:hook-into text-mode)) | 1482 | (:hook-into text-mode)) |
@@ -1476,7 +1512,9 @@ successive invocations." | |||
1476 | (:straight request) | 1512 | (:straight request) |
1477 | (:option mastodon-instance-url "https://writing.exchange" | 1513 | (:option mastodon-instance-url "https://writing.exchange" |
1478 | mastodon-auth-source-file (car auth-sources) | 1514 | mastodon-auth-source-file (car auth-sources) |
1479 | mastodon-client--token-file (acdw/dir "mastodon.plstore"))) | 1515 | mastodon-client--token-file (acdw/dir "mastodon.plstore")) |
1516 | (:hook hl-line-mode | ||
1517 | olivetti-mode)) | ||
1480 | 1518 | ||
1481 | (setup (:straight (modus-themes | 1519 | (setup (:straight (modus-themes |
1482 | :host gitlab | 1520 | :host gitlab |
@@ -1492,6 +1530,8 @@ successive invocations." | |||
1492 | (acdw/sunrise-sunset #'modus-themes-load-operandi | 1530 | (acdw/sunrise-sunset #'modus-themes-load-operandi |
1493 | #'modus-themes-load-vivendi)) | 1531 | #'modus-themes-load-vivendi)) |
1494 | 1532 | ||
1533 | (setup (:straight markdown-mode)) | ||
1534 | |||
1495 | (setup (:straight mwim) | 1535 | (setup (:straight mwim) |
1496 | (:global "C-a" mwim-beginning | 1536 | (:global "C-a" mwim-beginning |
1497 | "C-e" mwim-end)) | 1537 | "C-e" mwim-end)) |
@@ -1673,6 +1713,11 @@ successive invocations." | |||
1673 | (dolist (mode lispy-modes) | 1713 | (dolist (mode lispy-modes) |
1674 | (add-hook (intern (concat (symbol-name mode) "-hook")) #'paren-face-mode))) | 1714 | (add-hook (intern (concat (symbol-name mode) "-hook")) #'paren-face-mode))) |
1675 | 1715 | ||
1716 | (setup (:straight persistent-scratch) | ||
1717 | (:option persistent-scratch-backup-directory (acdw/dir "scratch" t) | ||
1718 | persistent-scratch-keep-n-newest-backups 12)) | ||
1719 | (persistent-scratch-setup-default)) | ||
1720 | |||
1676 | (setup (:straight restart-emacs) | 1721 | (setup (:straight restart-emacs) |
1677 | (defun emacs-upgrade (&optional update-packages) | 1722 | (defun emacs-upgrade (&optional update-packages) |
1678 | "Pull config, upgrade packages, restart Emacs." | 1723 | "Pull config, upgrade packages, restart Emacs." |
@@ -1695,11 +1740,12 @@ successive invocations." | |||
1695 | acdw-modeline/wc | 1740 | acdw-modeline/wc |
1696 | acdw-modeline/text-scale | 1741 | acdw-modeline/text-scale |
1697 | simple-modeline-segment-process | 1742 | simple-modeline-segment-process |
1743 | acdw-modeline/track | ||
1698 | acdw-modeline/god-mode-indicator | 1744 | acdw-modeline/god-mode-indicator |
1699 | acdw-modeline/winum | 1745 | acdw-modeline/winum |
1700 | acdw-modeline/minions | 1746 | acdw-modeline/minions |
1701 | acdw-modeline/narrowed | 1747 | acdw-modeline/narrowed |
1702 | simple-modeline-segment-major-mode))) | 1748 | acdw-modeline/major-mode))) |
1703 | 1749 | ||
1704 | ;; I've put in a pull request to add the (- 0 right-margin) bit here. | 1750 | ;; I've put in a pull request to add the (- 0 right-margin) bit here. |
1705 | (advice-add 'simple-modeline--format :override | 1751 | (advice-add 'simple-modeline--format :override |
@@ -1947,7 +1993,7 @@ call `zzz-to-char'." | |||
1947 | 1993 | ||
1948 | (add-hook 'after-make-frame-functions | 1994 | (add-hook 'after-make-frame-functions |
1949 | (defun after-make-frame@maximize (frame) | 1995 | (defun after-make-frame@maximize (frame) |
1950 | (unless (or edit-server-edit-mode) | 1996 | (unless (bound-and-true-p edit-server-frame-p) |
1951 | (toggle-frame-maximized frame))))) | 1997 | (toggle-frame-maximized frame))))) |
1952 | 1998 | ||
1953 | ;;;; Work | 1999 | ;;;; Work |
diff --git a/lisp/acdw-erc.el b/lisp/acdw-erc.el index e375c61..dd8525d 100644 --- a/lisp/acdw-erc.el +++ b/lisp/acdw-erc.el | |||
@@ -78,9 +78,9 @@ If USE-TLS is non-nil, use TLS." | |||
78 | "Reconnect to all IRC servers." | 78 | "Reconnect to all IRC servers." |
79 | (interactive) | 79 | (interactive) |
80 | (dolist (buffer (filter-server-buffers)) | 80 | (dolist (buffer (filter-server-buffers)) |
81 | (with-message (format "Reconnecting to server: %s" (buffer-name buffer)) | 81 | (with-current-buffer buffer |
82 | (with-current-buffer buffer | 82 | (ignore-errors |
83 | (erc-server-reconnect))))) | 83 | (erc-cmd-RECONNECT))))) |
84 | 84 | ||
85 | (defun erc/disconnect () | 85 | (defun erc/disconnect () |
86 | "Disconnect from all IRC servers." | 86 | "Disconnect from all IRC servers." |
@@ -183,11 +183,9 @@ erc-modified-channels-alist. Should be executed on window change." | |||
183 | "Overlay used to set bar") | 183 | "Overlay used to set bar") |
184 | 184 | ||
185 | (setq erc-bar-overlay (make-overlay 0 0)) | 185 | (setq erc-bar-overlay (make-overlay 0 0)) |
186 | 186 | (overlay-put erc-bar-overlay 'face '(:overline "gray")) | |
187 | 187 | ||
188 | (with-eval-after-load 'erc-track | 188 | (with-eval-after-load 'erc-track |
189 | (overlay-put erc-bar-overlay 'face '(:underline "gray")) | ||
190 | |||
191 | ;;put the hook before erc-modified-channels-update | 189 | ;;put the hook before erc-modified-channels-update |
192 | (defadvice erc-track-mode (after erc-bar-setup-hook | 190 | (defadvice erc-track-mode (after erc-bar-setup-hook |
193 | (&rest args) activate) | 191 | (&rest args) activate) |
@@ -197,5 +195,34 @@ erc-modified-channels-alist. Should be executed on window change." | |||
197 | (erc-bar-update-overlay)))) | 195 | (erc-bar-update-overlay)))) |
198 | 196 | ||
199 | 197 | ||
198 | ;;; ZNC babeee | ||
199 | ;; needed variables are stored in private.el | ||
200 | (defun znc/connect (znc-server znc-port znc-nick irc-servers) | ||
201 | (interactive (let ((zserv (or znc/server | ||
202 | (read-string "ZNC Server: "))) | ||
203 | (zport (or znc/port | ||
204 | (read-number "ZNC Port: "))) | ||
205 | (znick (or znc/nick | ||
206 | (read-string "ZNC Nick: "))) | ||
207 | (servers (or znc/irc-servers | ||
208 | (list | ||
209 | (cons | ||
210 | (read-string "IRC Server to connect to: ") | ||
211 | (read-passwd "Password: ")))))) | ||
212 | (list zserv zport znick servers))) | ||
213 | (let ((si 0)) | ||
214 | (dolist (server irc-servers) | ||
215 | (run-at-time si nil | ||
216 | (lambda () | ||
217 | (erc-tls :server znc-server | ||
218 | :port znc-port | ||
219 | :nick znc-nick | ||
220 | :password (format "%s/%s:%s" | ||
221 | znc-nick | ||
222 | (car server) | ||
223 | (cdr server))))) | ||
224 | (setq si (1+ si))))) | ||
225 | |||
226 | |||
200 | (provide 'acdw-erc) | 227 | (provide 'acdw-erc) |
201 | ;;; acdw-erc.el ends here | 228 | ;;; acdw-erc.el ends here |
diff --git a/lisp/acdw-irc.el b/lisp/acdw-irc.el new file mode 100644 index 0000000..193275c --- /dev/null +++ b/lisp/acdw-irc.el | |||
@@ -0,0 +1,84 @@ | |||
1 | ;;; acdw-irc.el -*- lexical-binding: t; coding: utf-8-unix -*- | ||
2 | |||
3 | (require 's nil :noerror) | ||
4 | |||
5 | (defgroup acdw-irc nil | ||
6 | "Customizations for IRC." | ||
7 | :group 'applications) | ||
8 | |||
9 | (defcustom acdw-irc/left-margin 16 | ||
10 | "The size of the margin for nicks, etc. on the left." | ||
11 | :type 'integer) | ||
12 | |||
13 | (defcustom acdw-irc/pre-nick "" | ||
14 | "What to show before a nick." | ||
15 | :type 'string) | ||
16 | |||
17 | (defcustom acdw-irc/post-nick " | " | ||
18 | "What to show after a nick." | ||
19 | :type 'string) | ||
20 | |||
21 | (defcustom acdw-irc/pre-my-nick "-" | ||
22 | "What to show before the current user's nick." | ||
23 | :type 'string) | ||
24 | |||
25 | (defcustom acdw-irc/post-my-nick "-> " | ||
26 | "What to show after the current user's nick." | ||
27 | :type 'string) | ||
28 | |||
29 | (defcustom acdw-irc/ellipsis "~" | ||
30 | "The ellipsis for when a string is too long." | ||
31 | :type 'string) | ||
32 | |||
33 | |||
34 | ;;; Convenience functions (I don't want to /depend/ on s.el) | ||
35 | |||
36 | (if (fboundp 's-repeat) | ||
37 | (defalias 'repeat-string 's-repeat) | ||
38 | (defun repeat-string (num s) | ||
39 | "Make a string of STR repeated NUM times. | ||
40 | Stolen from s.el." | ||
41 | (declare (pure t) (side-effect-free t)) | ||
42 | (let (ss) | ||
43 | (while (> num 0) | ||
44 | (setq ss (cons str ss) | ||
45 | num (1- num))) | ||
46 | (apply #'concat ss)))) | ||
47 | |||
48 | (if (fboundp 's-truncate) | ||
49 | (defalias 'truncate-string 's-truncate) | ||
50 | (defun truncate-string (len s &optional ellipsis) | ||
51 | "If STR is longer than LEN, cut it down and add ELLIPSIS to the end. | ||
52 | When not specified, ELLIPSIS defaults to '...'." | ||
53 | (declare (pure t) (side-effect-free t)) | ||
54 | (unless ellipsis | ||
55 | (setq ellipsis "...")) | ||
56 | (if (> (length s) len) | ||
57 | (format "%s%s" (substring s 0 (- len (length ellipsis))) ellipsis) | ||
58 | s))) | ||
59 | |||
60 | |||
61 | ;;; IRC stuff | ||
62 | |||
63 | (defun acdw-irc/margin-format (str &optional before after alignment) | ||
64 | "Print STR to fit in `acdw-irc/left-margin'. | ||
65 | Optional arguments BEFORE and AFTER specify strings to go | ||
66 | ... before and after the string. ALIGNMENT aligns left on nil | ||
67 | and right on t." | ||
68 | (let* ((before (or before "")) | ||
69 | (after (or after "")) | ||
70 | (str-length (length str)) | ||
71 | (before-length (length before)) | ||
72 | (after-length (length after)) | ||
73 | (max-length (- acdw-irc/left-margin 1 (+ before-length after-length))) | ||
74 | (left-over (max 0 (- max-length str-length)))) | ||
75 | (format "%s%s%s%s%s" | ||
76 | before | ||
77 | (if alignment (repeat-string left-over " ") "") | ||
78 | (truncate-string max-length str acdw-irc/ellipsis) | ||
79 | (if alignment "" (repeat-string left-over " ")) | ||
80 | after))) | ||
81 | |||
82 | |||
83 | (provide 'acdw-irc) | ||
84 | ;;; acdw-irc.el ends here | ||
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 5784148..6a11418 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el | |||
@@ -22,6 +22,15 @@ | |||
22 | (require 'simple-modeline) | 22 | (require 'simple-modeline) |
23 | (require 'minions) | 23 | (require 'minions) |
24 | 24 | ||
25 | (defcustom acdw-modeline/word-count-modes | ||
26 | (mapcar (lambda (m) (cons m nil)) simple-modeline-word-count-modes) | ||
27 | "Alist of modes to functions that `acdw-modeline/word-count' should dispatch. | ||
28 | If the cdr of the cons cell is nil, use the default function (`count-words'). | ||
29 | Otherwise, cdr should be a function that takes two points (see `count-words')." | ||
30 | :type '(alist :key-type (symbol :tag "Major-Mode") | ||
31 | :value-type function) | ||
32 | :group 'simple-modeline) | ||
33 | |||
25 | (defun acdw-modeline/buffer-name () ; gonsie | 34 | (defun acdw-modeline/buffer-name () ; gonsie |
26 | "Display the buffer name in a face reflecting its modified status." | 35 | "Display the buffer name in a face reflecting its modified status." |
27 | (propertize " %b " | 36 | (propertize " %b " |
@@ -40,7 +49,35 @@ | |||
40 | (defun acdw-modeline/god-mode-indicator () | 49 | (defun acdw-modeline/god-mode-indicator () |
41 | "Display an indicator if `god-local-mode' is active." | 50 | "Display an indicator if `god-local-mode' is active." |
42 | (when (bound-and-true-p god-local-mode) | 51 | (when (bound-and-true-p god-local-mode) |
43 | " God")) | 52 | " Ω")) |
53 | |||
54 | (defun acdw-modeline/major-mode () | ||
55 | "Displays the current major mode in the mode-line." | ||
56 | (propertize | ||
57 | (concat " " | ||
58 | (or (and (boundp 'delighted-modes) | ||
59 | (cadr (assq major-mode delighted-modes))) | ||
60 | (format-mode-line mode-name))) | ||
61 | 'face 'bold | ||
62 | 'keymap mode-line-major-mode-keymap | ||
63 | 'mouse-face 'mode-line-highlight)) | ||
64 | |||
65 | (defun acdw-modeline/minions () ; by me | ||
66 | "Display a button for `minions-minor-modes-menu'." | ||
67 | (concat | ||
68 | " " | ||
69 | (propertize | ||
70 | "&" | ||
71 | 'help-echo (format | ||
72 | "Minor modes menu\nmouse-1: show menu.") | ||
73 | 'local-map (purecopy (simple-modeline-make-mouse-map | ||
74 | 'mouse-1 | ||
75 | (lambda (event) | ||
76 | (interactive "e") | ||
77 | (with-selected-window (posn-window | ||
78 | (event-start event)) | ||
79 | (minions-minor-modes-menu))))) | ||
80 | 'mouse-face 'mode-line-highlight))) | ||
44 | 81 | ||
45 | (defun acdw-modeline/modified () ; modified from `simple-modeline' | 82 | (defun acdw-modeline/modified () ; modified from `simple-modeline' |
46 | "Displays a color-coded buffer modification/read-only | 83 | "Displays a color-coded buffer modification/read-only |
@@ -64,23 +101,6 @@ indicator in the mode-line." | |||
64 | (read-only-mode 'toggle))))) | 101 | (read-only-mode 'toggle))))) |
65 | 'mouse-face 'mode-line-highlight)))) | 102 | 'mouse-face 'mode-line-highlight)))) |
66 | 103 | ||
67 | (defun acdw-modeline/minions () ; by me | ||
68 | "Display a button for `minions-minor-modes-menu'." | ||
69 | (concat | ||
70 | " " | ||
71 | (propertize | ||
72 | "&" | ||
73 | 'help-echo (format | ||
74 | "Minor modes menu\nmouse-1: show menu.") | ||
75 | 'local-map (purecopy (simple-modeline-make-mouse-map | ||
76 | 'mouse-1 | ||
77 | (lambda (event) | ||
78 | (interactive "e") | ||
79 | (with-selected-window (posn-window | ||
80 | (event-start event)) | ||
81 | (minions-minor-modes-menu))))) | ||
82 | 'mouse-face 'mode-line-highlight))) | ||
83 | |||
84 | (defun acdw-modeline/narrowed () | 104 | (defun acdw-modeline/narrowed () |
85 | "Display an indication if the buffer is narrowed." | 105 | "Display an indication if the buffer is narrowed." |
86 | (when (buffer-narrowed-p) | 106 | (when (buffer-narrowed-p) |
@@ -135,6 +155,11 @@ is, if point < mark." | |||
135 | " (%-d)") | 155 | " (%-d)") |
136 | text-scale-mode-amount))) | 156 | text-scale-mode-amount))) |
137 | 157 | ||
158 | (defun acdw-modeline/track () | ||
159 | "Display `tracking-mode' information." | ||
160 | (when tracking-mode | ||
161 | tracking-mode-line-buffers)) | ||
162 | |||
138 | (defun acdw-modeline/vc-branch () | 163 | (defun acdw-modeline/vc-branch () |
139 | "Display the version control branch of the current buffer in the modeline." | 164 | "Display the version control branch of the current buffer in the modeline." |
140 | ;; from https://www.gonsie.com/blorg/modeline.html, from Doom | 165 | ;; from https://www.gonsie.com/blorg/modeline.html, from Doom |
@@ -148,15 +173,6 @@ Only shows if there is more than one window." | |||
148 | (> winum--window-count 1)) | 173 | (> winum--window-count 1)) |
149 | (format winum-format (winum-get-number-string)))) | 174 | (format winum-format (winum-get-number-string)))) |
150 | 175 | ||
151 | (defcustom acdw-modeline/word-count-modes | ||
152 | (mapcar (lambda (m) (cons m nil)) simple-modeline-word-count-modes) | ||
153 | "Alist of modes to functions that `acdw-modeline/word-count' should dispatch. | ||
154 | If the cdr of the cons cell is nil, use the default function (`count-words'). | ||
155 | Otherwise, cdr should be a function that takes two points (see `count-words')." | ||
156 | :type '(alist :key-type (symbol :tag "Major-Mode") | ||
157 | :value-type function) | ||
158 | :group 'simple-modeline) | ||
159 | |||
160 | (defun acdw-modeline/word-count () | 176 | (defun acdw-modeline/word-count () |
161 | "Display a buffer word count, depending on the major mode. | 177 | "Display a buffer word count, depending on the major mode. |
162 | Uses `acdw-modeline/word-count-modes' to determine which function to use." | 178 | Uses `acdw-modeline/word-count-modes' to determine which function to use." |