From 6bc84b094065df3e51f0ef97c65fb8684264d697 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 4 Nov 2016 14:18:38 +0100 Subject: [PATCH] Add topic change circe formatter --- emacs/.emacs.d/vendor-lisp/sermon/sermon.el | 22 +++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/vendor-lisp/sermon/sermon.el b/emacs/.emacs.d/vendor-lisp/sermon/sermon.el index 06a4490..6e55de5 100644 --- a/emacs/.emacs.d/vendor-lisp/sermon/sermon.el +++ b/emacs/.emacs.d/vendor-lisp/sermon/sermon.el @@ -58,6 +58,8 @@ "The original value of `circe-format-server-part'.") (defvar sermon-original-format-server-nick-change nil "The original value of `circe-format-server-nick-change'.") +(defvar sermon-original-format-server-topic nil + "The original vlaue of `circe-format-server-topic'.") (defun sermon--fill-string () (make-string (+ sermon-longest-nick 3) ?\s)) @@ -144,6 +146,14 @@ (plist-put keywords :intro "***")) 'wrap-prefix (sermon--fill-string))) +(defun sermon-server-topic-formatter (&rest keywords) + (propertize + (lui-format + (format "{intro:%ds} {nick} changed topic to: {new-topic}" + sermon-longest-nick) + (plist-put keywords :intro "***")) + 'wrap-prefix (sermon--fill-string))) + ;;;###autoload (defun enable-sermon () (interactive) @@ -203,7 +213,13 @@ (setq sermon-original-format-server-nick-change circe-format-server-nick-change)) (setq circe-format-server-nick-change - #'sermon-server-nick-change-formatter)) + #'sermon-server-nick-change-formatter) + + (if (null sermon-original-format-server-topic) + (setq sermon-original-format-server-topic + circe-format-server-topic)) + (setq circe-format-server-topic + #'sermon-server-topic-formatter)) (defun disable-sermon () (interactive) @@ -228,7 +244,9 @@ circe-format-server-part sermon-original-format-server-part sermon-original-format-server-part nil circe-format-server-nick-change sermon-original-format-server-nick-change - sermon-original-format-server-nick-change nil)) + sermon-original-format-server-nick-change nil + circe-format-server-topic sermon-original-format-server-topic + sermon-original-format-topic nil)) (provide 'sermon) ;;; sermon.el ends here