Further improve IRC experience

- Add SLAP command
- Kill buffer on PART
- Turns out, circe formatting variables can be functions!  Thank the gods :D
This commit is contained in:
Case Duckworth 2021-09-03 16:19:27 -05:00
parent 55962fcaf4
commit e8d4afa471
2 changed files with 50 additions and 28 deletions

64
init.el
View File

@ -1232,6 +1232,7 @@ like a dumbass."
(:option acdw-irc/left-margin 12
acdw-irc/post-my-nick "-> "
circe-channel-killed-confirmation nil
circe-color-nicks-everywhere t
circe-default-nick "acdw"
circe-default-part-message "See You, Space Cowpokes . . ."
@ -1264,6 +1265,12 @@ like a dumbass."
((t (:inherit (modus-themes-hl-line))))
:now))
(:bind "C-c C-p" circe-command-PART)
(:advise circe-command-PART :after
(defun circe-command-PART@kill-buffer (&rest _)
(kill-buffer)))
(add-hook 'circe-chat-mode-hook
(defun circe-chat@setup ()
(lui-set-prompt
@ -1284,34 +1291,35 @@ like a dumbass."
(add-hook 'modus-themes-after-load-theme-hook
#'circe-nick-color-reset)
(let ((len (number-to-string (- acdw-irc/left-margin 1
(+ (length acdw-irc/pre-nick)
(length acdw-irc/post-nick)))))
(my-len (number-to-string (- acdw-irc/left-margin 1
(+ (length acdw-irc/pre-my-nick)
(length acdw-irc/post-my-nick))))))
(setq circe-format-say (concat acdw-irc/pre-nick
"{nick:" len "." len "s} "
acdw-irc/post-nick
"{body}")
circe-format-self-say (concat acdw-irc/pre-my-nick
"{nick:" my-len "." my-len "s} "
acdw-irc/post-my-nick
"{body}")
circe-format-action (concat "*"
(repeat-string
(- acdw-irc/left-margin 3)
" ")
"* {nick} {body}")
circe-format-self-action (concat "-*"
(repeat-string
(- acdw-irc/left-margin 4)
" ")
"* {nick} {body}")
lui-fill-type (concat
(repeat-string (- acdw-irc/left-margin 2)
" ")
" ")))
(setq circe-format-say
(lambda (&rest plist)
(concat
(acdw-irc/margin-format (plist-get plist :nick) "" " |" t)
" "
(plist-get plist :body)))
circe-format-self-say
(lambda (&rest plist)
(concat
(acdw-irc/margin-format (plist-get plist :nick) "-" " >" t)
" "
(plist-get plist :body)))
circe-format-action
(lambda (&rest plist)
(concat
(acdw-irc/margin-format (plist-get plist :nick) "*" " *" t)
" "
(plist-get plist :body)))
circe-format-self-action
(lambda (&rest plist)
(concat
(acdw-irc/margin-format (plist-get plist :nick) "-*" " *" t)
" "
(plist-get plist :body)))
lui-fill-type (repeat-string acdw-irc/left-margin " "))
(:option lui-fill-column fill-column
lui-time-stamp-position 'right-margin

View File

@ -102,6 +102,20 @@ already been connected to."
(y-or-n-p (format "Already connected to %s, reconnect?" network)))
(circe network)))
;; the most important command ever.
(defun circe-command-SLAP (nick)
"Slap NICK around with a large trout."
(interactive "sNick: ")
(if (not circe-chat-target)
(circe-display-server-message "No target for current buffer")
(let ((line (concat "slaps " nick " around a bit with a large trout")))
(circe-display 'circe-format-self-action
:body line
:nick (circe-nick))
(irc-send-ctcp (circe-server-process)
circe-chat-target
"ACTION" line))))
(provide 'acdw-irc)
;;; acdw-irc.el ends here