emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100132: * lisp/erc/erc-backend.el


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100132: * lisp/erc/erc-backend.el (erc-process-sentinel): Check that buffer is alive
Date: Sat, 23 Oct 2010 12:35:22 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100132
author: Julien Danjou <address@hidden>
committer: Glenn Morris <address@hidden>
branch nick: emacs-23
timestamp: Sat 2010-10-23 12:35:22 -0700
message:
  * lisp/erc/erc-backend.el (erc-process-sentinel): Check that buffer is alive
  before setting it as current buffer.
modified:
  lisp/erc/ChangeLog
  lisp/erc/erc-backend.el
=== modified file 'lisp/erc/ChangeLog'
--- a/lisp/erc/ChangeLog        2010-10-12 23:25:19 +0000
+++ b/lisp/erc/ChangeLog        2010-10-23 19:35:22 +0000
@@ -1,3 +1,8 @@
+2010-10-23  Julien Danjou  <address@hidden>
+
+       * erc-backend.el (erc-process-sentinel): Check that buffer is alive
+       before setting it as current buffer.
+
 2010-10-12  Juanma Barranquero  <address@hidden>
 
        * erc-xdcc.el (erc-xdcc-help-text): Fix typo in docstring.

=== modified file 'lisp/erc/erc-backend.el'
--- a/lisp/erc/erc-backend.el   2010-01-25 18:49:23 +0000
+++ b/lisp/erc/erc-backend.el   2010-10-23 19:35:22 +0000
@@ -652,30 +652,31 @@
 
 (defun erc-process-sentinel (cproc event)
   "Sentinel function for ERC process."
-  (with-current-buffer (process-buffer cproc)
-    (erc-log (format
-              "SENTINEL: proc: %S       status: %S  event: %S (quitting: %S)"
-              cproc (process-status cproc) event erc-server-quitting))
-    (if (string-match "^open" event)
-        ;; newly opened connection (no wait)
-        (erc-login)
-      ;; assume event is 'failed
-      (let ((buf (process-buffer cproc)))
-        (erc-with-all-buffers-of-server cproc nil
-                                        (setq erc-server-connected nil))
-        (when erc-server-ping-handler
-          (progn (erc-cancel-timer erc-server-ping-handler)
-                 (setq erc-server-ping-handler nil)))
-        (run-hook-with-args 'erc-disconnected-hook
-                            (erc-current-nick) (system-name) "")
-        ;; Remove the prompt
-        (goto-char (or (marker-position erc-input-marker) (point-max)))
-        (forward-line 0)
-        (erc-remove-text-properties-region (point) (point-max))
-        (delete-region (point) (point-max))
-        ;; Decide what to do with the buffer
-        ;; Restart if disconnected
-        (erc-process-sentinel-1 event buf)))))
+  (let ((buf (process-buffer cproc)))
+    (when (buffer-live-p buf)
+      (with-current-buffer buf
+        (erc-log (format
+                  "SENTINEL: proc: %S   status: %S  event: %S (quitting: %S)"
+                  cproc (process-status cproc) event erc-server-quitting))
+        (if (string-match "^open" event)
+            ;; newly opened connection (no wait)
+            (erc-login)
+          ;; assume event is 'failed
+          (erc-with-all-buffers-of-server cproc nil
+                                          (setq erc-server-connected nil))
+          (when erc-server-ping-handler
+            (progn (erc-cancel-timer erc-server-ping-handler)
+                   (setq erc-server-ping-handler nil)))
+          (run-hook-with-args 'erc-disconnected-hook
+                              (erc-current-nick) (system-name) "")
+          ;; Remove the prompt
+          (goto-char (or (marker-position erc-input-marker) (point-max)))
+          (forward-line 0)
+          (erc-remove-text-properties-region (point) (point-max))
+          (delete-region (point) (point-max))
+          ;; Decide what to do with the buffer
+          ;; Restart if disconnected
+          (erc-process-sentinel-1 event buf))))))
 
 ;;;; Sending messages
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]