(erc-make-mode-line-buffer-name): Add help-echo and mouse-face
properties to channel name.
+2006-08-20 Michael Olson <mwolson@gnu.org>
+
+ * erc.el (erc-with-server-buffer): New macro that switches to the
+ current ERC server buffer and runs some code. If no server buffer
+ is available, return nil. This is a useful way to access
+ variables in the server buffer.
+ (erc-open-server-buffer-p): New function that returns non-nil if
+ the given buffer is an ERC server buffer that has an open IRC
+ process.
+
2006-08-14 Diane Murray <disumu@x3y2z1.net>
* erc-menu.el: Updated copyright years. Removed EmacsWiki URL.
(cdr (assq (aref s (match-beginning 0)) c)))))
s))
+(defmacro erc-with-server-buffer (&rest body)
+ "Execute BODY in the current ERC server buffer.
+If no server buffer exists, return nil."
+ (let ((buffer (make-symbol "buffer")))
+ `(let ((,buffer (erc-server-buffer)))
+ (when (buffer-live-p ,buffer)
+ (with-current-buffer ,buffer
+ ,@body)))))
+(put 'erc-with-server-buffer 'lisp-indent-function 0)
+(put 'erc-with-server-buffer 'edebug-form-spec '(body))
+
(defstruct (erc-server-user (:type vector) :named)
;; User data
nickname host login full-name info
(and (eq major-mode 'erc-mode)
(null (erc-default-target)))))
+(defun erc-open-server-buffer-p (&optional buffer)
+ "Return non-nil if argument BUFFER is an ERC server buffer that
+has an open IRC process.
+
+If BUFFER is nil, the current buffer is used."
+ (and (erc-server-buffer-p)
+ (erc-server-process-alive)))
+
(defun erc-query-buffer-p (&optional buffer)
"Return non-nil if BUFFER is an ERC query buffer.
If BUFFER is nil, the current buffer is used."