From cea77db0127d038b0d0728621ebea768ff832e09 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 8 Oct 2021 17:21:54 -0500 Subject: Add `circe-current-topic' and make topsy.el use it --- init.el | 7 ++++++- lisp/acdw-circe.el | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index b376d55..c68ea1e 100644 --- a/init.el +++ b/init.el @@ -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 "" #'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 diff --git a/lisp/acdw-circe.el b/lisp/acdw-circe.el index d6f5b90..ec15f8e 100644 --- a/lisp/acdw-circe.el +++ b/lisp/acdw-circe.el @@ -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) -- cgit 1.4.1-21-gabe81