changeset 74606:e6b28ccae7d8

erc-iswitchb: Temporarily enable iswitchb mode * erc.el: (erc-iswitchb): Temporarily enable iswitchb mode if it isn't active already, instead of leaving it on. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-555 Creator: Michael Olson <mwolson@gnu.org>
author Miles Bader <miles@gnu.org>
date Wed, 13 Dec 2006 02:36:31 +0000
parents 6ee41fdd69ff
children 2408d46ef69e
files lisp/erc/ChangeLog lisp/erc/erc.el
diffstat 2 files changed, 23 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/erc/ChangeLog	Wed Dec 13 01:13:58 2006 +0000
+++ b/lisp/erc/ChangeLog	Wed Dec 13 02:36:31 2006 +0000
@@ -1,3 +1,8 @@
+2006-12-13  Leo  <sdl.web@gmail.com>
+
+	* erc.el (erc-iswitchb): Temporarily enable iswitchb mode if it
+	isn't active already, instead of leaving it on.
+
 2006-12-10  Juanma Barranquero  <lekktu@gmail.com>
 
 	* erc-ezbounce.el (erc-ezb-init-session-list): Doc fix.
--- a/lisp/erc/erc.el	Wed Dec 13 01:13:58 2006 +0000
+++ b/lisp/erc/erc.el	Wed Dec 13 02:36:31 2006 +0000
@@ -1668,22 +1668,25 @@
 Due to some yet unresolved reason, global function `iswitchb-mode'
 needs to be active for this function to work."
   (interactive "P")
-  (eval-and-compile
+  (eval-when-compile
     (require 'iswitchb))
-  (let ((iswitchb-make-buflist-hook
-	 (lambda ()
-	   (setq iswitchb-temp-buflist
-		 (mapcar 'buffer-name
-			 (erc-buffer-list
-			  nil
-			  (when arg erc-server-process)))))))
-    (switch-to-buffer
-     (iswitchb-read-buffer
-      "Switch-to: "
-      (if (boundp 'erc-modified-channels-alist)
-	  (buffer-name (caar (last erc-modified-channels-alist)))
-	nil)
-      t))))
+  (let ((enabled iswitchb-mode))
+    (or enabled (iswitchb-mode 1))
+    (let ((iswitchb-make-buflist-hook
+	   (lambda ()
+	     (setq iswitchb-temp-buflist
+		   (mapcar 'buffer-name
+			   (erc-buffer-list
+			    nil
+			    (when arg erc-server-process)))))))
+      (switch-to-buffer
+       (iswitchb-read-buffer
+	"Switch-to: "
+	(if (boundp 'erc-modified-channels-alist)
+	    (buffer-name (caar (last erc-modified-channels-alist)))
+	  nil)
+	t)))
+    (or enabled (iswitchb-mode -1))))
 
 (defun erc-channel-list (proc)
   "Return a list of channel buffers.