about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-08-28 23:08:17 -0500
committerCase Duckworth2021-08-28 23:09:00 -0500
commit782cc6e31b08d73dfe4b0770f0cf6a20fc9d9859 (patch)
tree049786c11ab2ba1610fd311bcb5415f01dff8ae7
parentDON'T FORGET! PRIVATE.EL! ZNC! (diff)
downloademacs-782cc6e31b08d73dfe4b0770f0cf6a20fc9d9859.tar.gz
emacs-782cc6e31b08d73dfe4b0770f0cf6a20fc9d9859.zip
Change to circe
-rw-r--r--init.el76
-rw-r--r--lisp/acdw-irc.el84
-rw-r--r--lisp/acdw-modeline.el5
3 files changed, 163 insertions, 2 deletions
diff --git a/init.el b/init.el index e174823..5ab1559 100644 --- a/init.el +++ b/init.el
@@ -323,6 +323,7 @@
323 323
324 (:option 324 (:option
325 erc-auto-discard-away t 325 erc-auto-discard-away t
326 erc-auto-set-away t
326 erc-autoaway-idle-seconds 600 327 erc-autoaway-idle-seconds 600
327 erc-autoaway-message "BRB (autoaway: %i seconds)" 328 erc-autoaway-message "BRB (autoaway: %i seconds)"
328 erc-button-url-regexp browse-url-button-regexp 329 erc-button-url-regexp browse-url-button-regexp
@@ -333,7 +334,7 @@
333 erc-fill-static-center 14 334 erc-fill-static-center 14
334 erc-format-nick-function #'erc-format-truncate-@nick 335 erc-format-nick-function #'erc-format-truncate-@nick
335 erc-header-line-face-method #'erc/update-header-line-show-disconnected 336 erc-header-line-face-method #'erc/update-header-line-show-disconnected
336 erc-hide-list '("NICK" "MODE" "JOIN" "PART" "QUIT") 337 erc-hide-list '("NICK" "MODE" "JOIN" "PART" "QUIT" "AWAY")
337 erc-interpret-controls-p t 338 erc-interpret-controls-p t
338 erc-interpret-mirc-color t 339 erc-interpret-mirc-color t
339 erc-join-buffer 'bury 340 erc-join-buffer 'bury
@@ -353,7 +354,9 @@
353 erc-server-coding-system '(utf-8 . utf-8) 354 erc-server-coding-system '(utf-8 . utf-8)
354 erc-timestamp-intangible t 355 erc-timestamp-intangible t
355 erc-track-exclude-types (append erc-hide-list 356 erc-track-exclude-types (append erc-hide-list
356 '("AWAY" 357 '("AWAY" ; for some reason this triggers
358 ; track anyway... so it's in
359 ; `erc-hide-list'
357 "353" "324" "329" "332" "333" "477")) 360 "353" "324" "329" "332" "333" "477"))
358 erc-track-exclude-server-buffer t 361 erc-track-exclude-server-buffer t
359 erc-track-position-in-mode-line 'before-modes 362 erc-track-position-in-mode-line 'before-modes
@@ -1109,6 +1112,74 @@ like a dumbass."
1109(setup (:straight (beginend)) 1112(setup (:straight (beginend))
1110 (beginend-global-mode +1)) 1113 (beginend-global-mode +1))
1111 1114
1115(setup (:straight circe)
1116 (require 'circe)
1117 (require 'acdw-irc)
1118
1119 (setq acdw-irc/post-my-nick "-> ")
1120
1121 (setq circe-default-part-message "See You, Space Cowpokes . . ."
1122 circe-highlight-nick-type 'all
1123 ;; circe-network-options in private.el
1124 circe-reduce-lurker-spam t
1125 circe-server-auto-join-default-type :after-auth)
1126
1127 (add-hook 'circe-chat-mode-hook
1128 (defun circe-chat@setup ()
1129 (lui-set-prompt
1130 (concat (propertize (acdw-irc/margin-format (buffer-name)
1131 ""
1132 ">")
1133 'face 'circe-prompt-face
1134 'read-only t 'intangible t
1135 'cursor-intangible t)
1136 " "))
1137 (enable-circe-color-nicks)
1138 (enable-circe-display-images)
1139 (enable-circe-new-day-notifier)))
1140
1141 (setq circe-format-say (format "%s%s%d%s%s%s"
1142 acdw-irc/pre-nick
1143 "{nick:"
1144 (- acdw-irc/left-margin 1
1145 (+ (length acdw-irc/pre-nick)
1146 (length acdw-irc/post-nick)))
1147 "s} "
1148 acdw-irc/post-nick
1149 "{body}")
1150 circe-format-self-say (format "%s%s%d%s%s%s"
1151 acdw-irc/pre-my-nick
1152 "{nick:"
1153 (- acdw-irc/left-margin 1
1154 (+ (length acdw-irc/pre-my-nick)
1155 (length acdw-irc/post-my-nick)))
1156 "s} "
1157 acdw-irc/post-my-nick
1158 "{body}")
1159 circe-format-action (concat "*"
1160 (repeat-string (- acdw-irc/left-margin 3)
1161 " ")
1162 "* {nick} {body}")
1163 circe-format-self-action (concat "-*"
1164 (repeat-string (- acdw-irc/left-margin 4)
1165 " ")
1166 "* {nick} {body}")
1167 lui-fill-type (concat
1168 (repeat-string (- acdw-irc/left-margin 2)
1169 " ")
1170 " "))
1171
1172 (setq lui-time-stamp-position 'right-margin
1173 lui-time-stamp-format "%H:%M")
1174 (add-hook 'lui-mode-hook
1175 (defun lui-mode@setup ()
1176 (setq right-margin-width 5
1177 scroll-margin 0
1178 fringes-outside-margins t
1179 word-wrap t
1180 wrap-prefix (repeat-string
1181 (1+ acdw-irc/left-margin) " ")))))
1182
1112(setup (:straight (consult 1183(setup (:straight (consult
1113 :host github 1184 :host github
1114 :repo "minad/consult")) 1185 :repo "minad/consult"))
@@ -1696,6 +1767,7 @@ successive invocations."
1696 acdw-modeline/wc 1767 acdw-modeline/wc
1697 acdw-modeline/text-scale 1768 acdw-modeline/text-scale
1698 simple-modeline-segment-process 1769 simple-modeline-segment-process
1770 acdw-modeline/track
1699 acdw-modeline/god-mode-indicator 1771 acdw-modeline/god-mode-indicator
1700 acdw-modeline/winum 1772 acdw-modeline/winum
1701 acdw-modeline/minions 1773 acdw-modeline/minions
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.
40Stolen 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.
52When 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'.
65Optional arguments BEFORE and AFTER specify strings to go
66... before and after the string. ALIGNMENT aligns left on nil
67and 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 df2811f..6a11418 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -155,6 +155,11 @@ is, if point < mark."
155 " (%-d)") 155 " (%-d)")
156 text-scale-mode-amount))) 156 text-scale-mode-amount)))
157 157
158(defun acdw-modeline/track ()
159 "Display `tracking-mode' information."
160 (when tracking-mode
161 tracking-mode-line-buffers))
162
158(defun acdw-modeline/vc-branch () 163(defun acdw-modeline/vc-branch ()
159 "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."
160 ;; from https://www.gonsie.com/blorg/modeline.html, from Doom 165 ;; from https://www.gonsie.com/blorg/modeline.html, from Doom