Merged from emacs@sv.gnu.org
[bpt/emacs.git] / lisp / erc / erc-spelling.el
index 528668f..484ddb3 100644 (file)
@@ -1,6 +1,6 @@
 ;;; erc-spelling.el --- use flyspell in ERC
 
-;; Copyright (C) 2005, 2006  Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <forcer@forcix.cx>
 ;; Keywords: irc
   ;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is
   ;; called AFTER the server buffer is initialized.
   ((add-hook 'erc-connect-pre-hook 'erc-spelling-init)
-   (mapc (lambda (buffer)
-           (when buffer
-             (with-current-buffer buffer (erc-spelling-init))))
-         (erc-buffer-list)))
+   (dolist (buffer (erc-buffer-list))
+     (when (buffer-live-p buffer)
+       (with-current-buffer buffer (erc-spelling-init)))))
   ((remove-hook 'erc-connect-pre-hook 'erc-spelling-init)
-   (mapc (lambda (buffer)
-           (when buffer
-             (with-current-buffer buffer (flyspell-mode 0))))
-         (erc-buffer-list))))
+   (dolist (buffer (erc-buffer-list))
+     (when (buffer-live-p buffer)
+       (with-current-buffer buffer (flyspell-mode 0))))))
 
 (defcustom erc-spelling-dictionaries nil
   "An alist mapping buffer names to dictionaries.