summary refs log tree commit diff stats
path: root/lisp/+circe.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+circe.el')
-rw-r--r--lisp/+circe.el52
1 files changed, 29 insertions, 23 deletions
diff --git a/lisp/+circe.el b/lisp/+circe.el index e8c5079..382f0ab 100644 --- a/lisp/+circe.el +++ b/lisp/+circe.el
@@ -45,21 +45,27 @@
45 45
46;;; Channel information 46;;; Channel information
47 47
48(defvar-local +circe-current-topic ""
49 "Cached topic of the buffer's channel.")
50
48(defun +circe-current-topic (&optional message) 51(defun +circe-current-topic (&optional message)
49 "Return the topic of the current channel. 52 "Return the topic of the current channel.
50When called with optional MESSAGE non-nil, or interactively, also 53When called with optional MESSAGE non-nil, or interactively, also
51message the current topic." 54message the current topic."
52 (interactive "p") 55 (interactive "p")
53 (let ((topic 56 (let ((topic
54 (save-excursion 57 (or (save-excursion
55 (goto-char (point-max)) 58 (goto-char (point-max))
56 (or (re-search-backward 59 (and (re-search-backward
57 (rx (group "*** " 60 (rx (group "*** "
58 (or "Topic" "topic" "TOPIC") 61 (or "Topic" "topic" "TOPIC")
59 (* (not ":")) ": ") 62 (* (not ":")) ": ")
60 (group (+ nonl))))) 63 (group (+ nonl)))
61 (buffer-substring-no-properties 64 nil t)
62 (match-beginning 2) (match-end 2))))) 65 (buffer-substring-no-properties
66 (match-beginning 2) (match-end 2))))
67 +circe-current-topic)))
68 (setq +circe-current-topic topic)
63 (when message 69 (when message
64 (message "%s" topic)) 70 (message "%s" topic))
65 topic)) 71 topic))
@@ -86,8 +92,8 @@ replace {nick} in the string with {NO-NICK}."
86 "Make a formatting regex for CHAR delimiters. 92 "Make a formatting regex for CHAR delimiters.
87For entry into `lui-formatting-list'." 93For entry into `lui-formatting-list'."
88 `(rx (or bol whitespace) 94 `(rx (or bol whitespace)
89 (group ,char (+? (not (any whitespace ,char))) ,char) 95 (group ,char (+? (not (any whitespace ,char))) ,char)
90 (or eol whitespace))) 96 (or eol whitespace)))
91 97
92;;; Hooks & Advice 98;;; Hooks & Advice
93 99
@@ -139,7 +145,7 @@ For entry into `lui-formatting-list'."
139 "What to do with `circe-server' buffers when created.") 145 "What to do with `circe-server' buffers when created.")
140 146
141(el-patch-defun circe (network-or-server &rest server-options) 147(el-patch-defun circe (network-or-server &rest server-options)
142 "Connect to IRC. 148 "Connect to IRC.
143 149
144Connect to the given network specified by NETWORK-OR-SERVER. 150Connect to the given network specified by NETWORK-OR-SERVER.
145 151
@@ -157,16 +163,16 @@ All SERVER-OPTIONS are treated as variables by getting the string
157locally in the server buffer. 163locally in the server buffer.
158 164
159See `circe-network-options' for a list of common options." 165See `circe-network-options' for a list of common options."
160 (interactive (circe--read-network-and-options)) 166 (interactive (circe--read-network-and-options))
161 (let* ((options (circe--server-get-network-options network-or-server 167 (let* ((options (circe--server-get-network-options network-or-server
162 server-options)) 168 server-options))
163 (buffer (circe--server-generate-buffer options))) 169 (buffer (circe--server-generate-buffer options)))
164 (with-current-buffer buffer 170 (with-current-buffer buffer
165 (circe-server-mode) 171 (circe-server-mode)
166 (circe--server-set-variables options) 172 (circe--server-set-variables options)
167 (circe-reconnect)) 173 (circe-reconnect))
168 (el-patch-swap (pop-to-buffer-same-window buffer) 174 (el-patch-swap (pop-to-buffer-same-window buffer)
169 (funcall +circe-server-buffer-action buffer)))) 175 (funcall +circe-server-buffer-action buffer))))
170 176
171;;; Chat commands 177;;; Chat commands
172 178
@@ -177,7 +183,7 @@ See `circe-network-options' for a list of common options."
177 nil t nil))) 183 nil t nil)))
178 (circe-command-ME (format "slaps %s about a bit with a large trout" nick))) 184 (circe-command-ME (format "slaps %s about a bit with a large trout" nick)))
179 185
180;;; Filtering functions 186;;; Filtering functions --- XXX: These don't work right.
181;; Set `lui-input-function' to `+lui-filter', then add the filters you want to 187;; Set `lui-input-function' to `+lui-filter', then add the filters you want to
182;; `circe-channel-mode-hook'. 188;; `circe-channel-mode-hook'.
183 189