aboutsummaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d/vendor-lisp
diff options
context:
space:
mode:
authorGravatar Tom Willemse2016-11-04 14:18:38 +0100
committerGravatar Tom Willemse2016-11-04 14:18:38 +0100
commit6bc84b094065df3e51f0ef97c65fb8684264d697 (patch)
treea298ea57402e16563576e323120ed25d57cdf33f /emacs/.emacs.d/vendor-lisp
parent54d401566b0c8f787676b6ec75dfab9bddb4561e (diff)
downloadnew-dotfiles-6bc84b094065df3e51f0ef97c65fb8684264d697.tar.gz
new-dotfiles-6bc84b094065df3e51f0ef97c65fb8684264d697.zip
Add topic change circe formatter
Diffstat (limited to 'emacs/.emacs.d/vendor-lisp')
-rw-r--r--emacs/.emacs.d/vendor-lisp/sermon/sermon.el22
1 files 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