Add topic change circe formatter
This commit is contained in:
parent
54d401566b
commit
6bc84b0940
1 changed files with 20 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue