mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-04 11:40:22 +00:00
Merge from erc--main--0
Backport additional functions and macros that erc-capab.el needs. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-600 Creator: Michael Olson <mwolson@gnu.org>
This commit is contained in:
parent
6904f7fe8e
commit
01d9e862ba
@ -387,6 +387,16 @@
|
||||
(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.
|
||||
|
@ -355,6 +355,17 @@ nicknames with erc-server-user struct instances.")
|
||||
(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
|
||||
@ -1339,6 +1350,14 @@ If BUFFER is nil, the current buffer is used."
|
||||
(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."
|
||||
|
Loading…
Reference in New Issue
Block a user