aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2007-01-17 18:17:35 +0000
committerMiles Bader2007-01-17 18:17:35 +0000
commit01d9e862ba3a2f22b17e95c7086648f56415c357 (patch)
treeb4181d14baf62c146585e93edec7a7d4aa3d0d96
parent6904f7fe8ed11bf4c94c009b4ef300f4ccdfa2e6 (diff)
downloademacs-01d9e862ba3a2f22b17e95c7086648f56415c357.tar.gz
emacs-01d9e862ba3a2f22b17e95c7086648f56415c357.zip
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>
-rw-r--r--lisp/erc/ChangeLog10
-rw-r--r--lisp/erc/erc.el19
2 files changed, 29 insertions, 0 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 79ab94269ba..9b7b17ceec4 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -387,6 +387,16 @@
387 (erc-make-mode-line-buffer-name): Add help-echo and mouse-face 387 (erc-make-mode-line-buffer-name): Add help-echo and mouse-face
388 properties to channel name. 388 properties to channel name.
389 389
3902006-08-20 Michael Olson <mwolson@gnu.org>
391
392 * erc.el (erc-with-server-buffer): New macro that switches to the
393 current ERC server buffer and runs some code. If no server buffer
394 is available, return nil. This is a useful way to access
395 variables in the server buffer.
396 (erc-open-server-buffer-p): New function that returns non-nil if
397 the given buffer is an ERC server buffer that has an open IRC
398 process.
399
3902006-08-14 Diane Murray <disumu@x3y2z1.net> 4002006-08-14 Diane Murray <disumu@x3y2z1.net>
391 401
392 * erc-menu.el: Updated copyright years. Removed EmacsWiki URL. 402 * erc-menu.el: Updated copyright years. Removed EmacsWiki URL.
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 350a77b8210..927dce02d64 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -355,6 +355,17 @@ nicknames with erc-server-user struct instances.")
355 (cdr (assq (aref s (match-beginning 0)) c))))) 355 (cdr (assq (aref s (match-beginning 0)) c)))))
356 s)) 356 s))
357 357
358(defmacro erc-with-server-buffer (&rest body)
359 "Execute BODY in the current ERC server buffer.
360If no server buffer exists, return nil."
361 (let ((buffer (make-symbol "buffer")))
362 `(let ((,buffer (erc-server-buffer)))
363 (when (buffer-live-p ,buffer)
364 (with-current-buffer ,buffer
365 ,@body)))))
366(put 'erc-with-server-buffer 'lisp-indent-function 0)
367(put 'erc-with-server-buffer 'edebug-form-spec '(body))
368
358(defstruct (erc-server-user (:type vector) :named) 369(defstruct (erc-server-user (:type vector) :named)
359 ;; User data 370 ;; User data
360 nickname host login full-name info 371 nickname host login full-name info
@@ -1339,6 +1350,14 @@ If BUFFER is nil, the current buffer is used."
1339 (and (eq major-mode 'erc-mode) 1350 (and (eq major-mode 'erc-mode)
1340 (null (erc-default-target))))) 1351 (null (erc-default-target)))))
1341 1352
1353(defun erc-open-server-buffer-p (&optional buffer)
1354 "Return non-nil if argument BUFFER is an ERC server buffer that
1355has an open IRC process.
1356
1357If BUFFER is nil, the current buffer is used."
1358 (and (erc-server-buffer-p)
1359 (erc-server-process-alive)))
1360
1342(defun erc-query-buffer-p (&optional buffer) 1361(defun erc-query-buffer-p (&optional buffer)
1343 "Return non-nil if BUFFER is an ERC query buffer. 1362 "Return non-nil if BUFFER is an ERC query buffer.
1344If BUFFER is nil, the current buffer is used." 1363If BUFFER is nil, the current buffer is used."