Add `circe-current-topic' and make topsy.el use it

This commit is contained in:
Case Duckworth 2021-10-08 17:21:54 -05:00
parent 21fa2d0711
commit cea77db012
2 changed files with 22 additions and 1 deletions

View File

@ -1178,8 +1178,13 @@ specific to most general, they are these:
;; circe-my-message-face
;; ((t (:inherit (modus-themes-slant))))
))
(with-eval-after-load 'topsy
(:option (append topsy-mode-functions)
'(circe-channel-mode . circe-current-topic)))
(:bind "C-c C-p" #'circe-command-PART
"C-c C-t" #'circe-current-topic ; in acdw-circe.el
"C-l" #'lui-track-jump-to-indicator
"<C-return>" #'circe-chat@set-prompt)
@ -1197,7 +1202,7 @@ specific to most general, they are these:
(:bind "C-c C-s" #'circe-command-SLAP)
(autoload 'circe-nick-color-reset "circe-color-nicks")
(add-hook 'modus-themes-after-load-theme-hook
(add-hook 'modus-themes-after-theme-hook
#'circe-nick-color-reset)
(:with-mode lui-mode

View File

@ -8,6 +8,22 @@
(require 'circe)
;;; Functions
(defun circe-current-topic (&optional message)
"Return the topic of the current channel.
When called with MESSAGE set to non-nil (or interactively), also
message the current topic."
(interactive "p")
(let ((topic
(save-excursion
(re-search-backward (rx "*** Topic for #" (+ (or word "-")) ": "))
(buffer-substring-no-properties
(match-end 0) (line-end-position)))))
(when message
(message "%s" topic))
topic))
;;; Chat commands
(defun circe-command-SHORTEN (url)