diff options
author | 2016-08-28 01:18:52 +0200 | |
---|---|---|
committer | 2016-08-28 01:18:52 +0200 | |
commit | cd257205edd1b5044a061c83da433ea7cbb89cbb (patch) | |
tree | 228fdf287f83c777bb2375adf1d37c354186a34e /emacs/.emacs.d/vendor-lisp/sermon/sermon.el | |
parent | ced484c62a1107212aaa80aea11c2f3f6a959834 (diff) | |
download | new-dotfiles-cd257205edd1b5044a061c83da433ea7cbb89cbb.tar.gz new-dotfiles-cd257205edd1b5044a061c83da433ea7cbb89cbb.zip |
Make sermon usable with visual-line-mode
Diffstat (limited to 'emacs/.emacs.d/vendor-lisp/sermon/sermon.el')
-rw-r--r-- | emacs/.emacs.d/vendor-lisp/sermon/sermon.el | 93 |
1 files changed, 58 insertions, 35 deletions
diff --git a/emacs/.emacs.d/vendor-lisp/sermon/sermon.el b/emacs/.emacs.d/vendor-lisp/sermon/sermon.el index 6e8eacc..f2efcde 100644 --- a/emacs/.emacs.d/vendor-lisp/sermon/sermon.el +++ b/emacs/.emacs.d/vendor-lisp/sermon/sermon.el @@ -59,67 +59,90 @@ (defvar sermon-original-format-server-nick-change nil "The original value of `circe-format-server-nick-change'.") +(defun sermon--fill-string () + (make-string (+ sermon-longest-nick 3) ?\s)) + (defun sermon--update-longest-nick (keywords) (let* ((nick (plist-get keywords :nick)) (len (length nick))) (when (> len sermon-longest-nick) (setq sermon-longest-nick len) - (setq-local lui-fill-type (make-string (+ len 3) ?\s))))) + (when lui-fill-type + (setq-local lui-fill-type (sermon--fill-string)))))) (defun sermon-say-formatter (&rest keywords) (sermon--update-longest-nick keywords) - (lui-format (format "{nick:%ds} {body}" sermon-longest-nick) - keywords)) + (propertize + (lui-format (format "{nick:%ds} {body}" sermon-longest-nick) + keywords) + 'wrap-prefix (sermon--fill-string))) (defun sermon-self-say-formatter (&rest keywords) - (format (format "%%%ds %%s" sermon-longest-nick) - ">" (plist-get keywords :body))) + (propertize (format (format "%%%ds %%s" sermon-longest-nick) + ">" (plist-get keywords :body)) + 'wrap-prefix (sermon--fill-string))) (defun sermon-action-formatter (&rest keywords) - (lui-format - (format "{intro:%ds} {nick} {body}" sermon-longest-nick) - (plist-put keywords :intro "*"))) + (propertize + (lui-format + (format "{intro:%ds} {nick} {body}" sermon-longest-nick) + (plist-put keywords :intro "*")) + 'wrap-prefix (sermon--fill-string))) (defun sermon-server-message-formatter (&rest keywords) - (lui-format - (format "{intro:%ds} {body}" sermon-longest-nick) - (plist-put keywords :intro "***"))) + (propertize + (lui-format + (format "{intro:%ds} {body}" sermon-longest-nick) + (plist-put keywords :intro "***")) + 'wrap-prefix (sermon--fill-string))) (defun sermon-server-join-in-channel-formatter (&rest keywords) - (lui-format - (format "{intro:%ds} Join: {nick} ({userinfo}) joined {channel}" - sermon-longest-nick) - (plist-put keywords :intro ">>>"))) + (propertize + (lui-format + (format "{intro:%ds} Join: {nick} ({userinfo}) joined {channel}" + sermon-longest-nick) + (plist-put keywords :intro ">>>")) + 'wrap-prefix (sermon--fill-string))) (defun sermon-server-join-formatter (&rest keywords) - (lui-format - (format "{intro:%ds} Join: {nick} ({userinfo})" - sermon-longest-nick) - (plist-put keywords :intro ">>>"))) + (propertize + (lui-format + (format "{intro:%ds} Join: {nick} ({userinfo})" + sermon-longest-nick) + (plist-put keywords :intro ">>>")) + 'wrap-prefix (sermon--fill-string))) (defun sermon-server-quit-formatter (&rest keywords) - (lui-format - (format "{intro:%ds} Quit: {nick} ({userhost}) left IRC: {reason}" - sermon-longest-nick) - (plist-put keywords :intro "<<<"))) + (propertize + (lui-format + (format "{intro:%ds} Quit: {nick} ({userhost}) left IRC: {reason}" + sermon-longest-nick) + (plist-put keywords :intro "<<<")) + 'wrap-prefix (sermon--fill-string))) (defun sermon-server-quit-channel-formatter (&rest keywords) - (lui-format - (format "{intro:%ds} Quit: {nick} ({userhost}) left {channel}: {reason}" - sermon-longest-nick) - (plist-put keywords :intro "<<<"))) + (propertize + (lui-format + (format "{intro:%ds} Quit: {nick} ({userhost}) left {channel}: {reason}" + sermon-longest-nick) + (plist-put keywords :intro "<<<")) + 'wrap-prefix (sermon--fill-string))) (defun sermon-server-part-formatter (&rest keywords) - (lui-format - (format "{intro:%ds} Part: {nick} ({userhost}) left {channel}: {reason}" - sermon-longest-nick) - (plist-put keywords :intro "***"))) + (propertize + (lui-format + (format "{intro:%ds} Part: {nick} ({userhost}) left {channel}: {reason}" + sermon-longest-nick) + (plist-put keywords :intro "***")) + 'wrap-prefix (sermon--fill-string))) (defun sermon-server-nick-change-formatter (&rest keywords) - (lui-format - (format "{intro:%ds} Nick change: {old-nick} ({userhost}) is now know as {new-nick}" - sermon-longest-nick) - (plist-put keywords :intro "***"))) + (propertize + (lui-format + (format "{intro:%ds} Nick change: {old-nick} ({userhost}) is now know as {new-nick}" + sermon-longest-nick) + (plist-put keywords :intro "***")) + 'wrap-prefix (sermon--fill-string))) ;;;###autoload (defun enable-sermon () |