* lisp/net/rcirc.el (defun-rcirc-join): Accept multiple channels.
authorDeniz Dogan <deniz.a.m.dogan@gmail.com>
Fri, 11 Feb 2011 06:19:34 +0000 (07:19 +0100)
committerDeniz Dogan <deniz.a.m.dogan@gmail.com>
Fri, 11 Feb 2011 06:19:34 +0000 (07:19 +0100)
lisp/ChangeLog
lisp/net/rcirc.el

index 6f860d8..b3735e3 100644 (file)
@@ -1,3 +1,7 @@
+2011-02-11  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
+
+       * net/rcirc.el (defun-rcirc-join): Accept multiple channels.
+
 2011-02-11  Glenn Morris  <rgm@gnu.org>
 
        * emacs-lisp/cl-specs.el (multiple-value-bind): Fix debug spec.
index c3e4f3d..8657dc5 100644 (file)
@@ -2098,14 +2098,18 @@ activity.  Only run if the buffer is not visible and
     (when (not existing-buffer)
       (rcirc-cmd-whois nick))))
 
-(defun-rcirc-command join (channel)
-  "Join CHANNEL."
-  (interactive "sJoin channel: ")
-  (let ((buffer (rcirc-get-buffer-create process
-                                         (car (split-string channel)))))
-    (rcirc-send-string process (concat "JOIN " channel))
+(defun-rcirc-command join (channels)
+  "Join CHANNELS.
+CHANNELS is a comma- or space-separated string of channel names."
+  (interactive "sJoin channels: ")
+  (let* ((split-channels (split-string channels "[ ,]" t))
+         (buffers (mapcar (lambda (ch)
+                            (rcirc-get-buffer-create process ch))
+                          split-channels)))
+    (rcirc-send-string process (concat "JOIN " channels))
     (when (not (eq (selected-window) (minibuffer-window)))
-      (switch-to-buffer buffer))))
+      (dolist (b buffers) ;; order the new channel buffers in the buffer list
+        (switch-to-buffer b)))))
 
 ;; TODO: /part #channel reason, or consider removing #channel altogether
 (defun-rcirc-command part (channel)