diff options
| author | Julien Danjou | 2010-10-23 12:35:22 -0700 |
|---|---|---|
| committer | Glenn Morris | 2010-10-23 12:35:22 -0700 |
| commit | 6bb55f7cb0258425ff49bd65533aeb16a58afb67 (patch) | |
| tree | 19198e97271f452f4a6f83ccae20a9ed6ae38d9e | |
| parent | 0d0d9424a23a1fd11c96b7aa5bba80c88758ddfa (diff) | |
| download | emacs-6bb55f7cb0258425ff49bd65533aeb16a58afb67.tar.gz emacs-6bb55f7cb0258425ff49bd65533aeb16a58afb67.zip | |
* lisp/erc/erc-backend.el (erc-process-sentinel): Check that buffer is alive
before setting it as current buffer.
| -rw-r--r-- | lisp/erc/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/erc/erc-backend.el | 49 |
2 files changed, 30 insertions, 24 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 4568b598a3b..4143893008f 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-10-23 Julien Danjou <julien@danjou.info> | ||
| 2 | |||
| 3 | * erc-backend.el (erc-process-sentinel): Check that buffer is alive | ||
| 4 | before setting it as current buffer. | ||
| 5 | |||
| 1 | 2010-10-12 Juanma Barranquero <lekktu@gmail.com> | 6 | 2010-10-12 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | * erc-xdcc.el (erc-xdcc-help-text): Fix typo in docstring. | 8 | * erc-xdcc.el (erc-xdcc-help-text): Fix typo in docstring. |
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 8b533b4c255..92b1c761a30 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el | |||
| @@ -652,30 +652,31 @@ Conditionally try to reconnect and take appropriate action." | |||
| 652 | 652 | ||
| 653 | (defun erc-process-sentinel (cproc event) | 653 | (defun erc-process-sentinel (cproc event) |
| 654 | "Sentinel function for ERC process." | 654 | "Sentinel function for ERC process." |
| 655 | (with-current-buffer (process-buffer cproc) | 655 | (let ((buf (process-buffer cproc))) |
| 656 | (erc-log (format | 656 | (when (buffer-live-p buf) |
| 657 | "SENTINEL: proc: %S status: %S event: %S (quitting: %S)" | 657 | (with-current-buffer buf |
| 658 | cproc (process-status cproc) event erc-server-quitting)) | 658 | (erc-log (format |
| 659 | (if (string-match "^open" event) | 659 | "SENTINEL: proc: %S status: %S event: %S (quitting: %S)" |
| 660 | ;; newly opened connection (no wait) | 660 | cproc (process-status cproc) event erc-server-quitting)) |
| 661 | (erc-login) | 661 | (if (string-match "^open" event) |
| 662 | ;; assume event is 'failed | 662 | ;; newly opened connection (no wait) |
| 663 | (let ((buf (process-buffer cproc))) | 663 | (erc-login) |
| 664 | (erc-with-all-buffers-of-server cproc nil | 664 | ;; assume event is 'failed |
| 665 | (setq erc-server-connected nil)) | 665 | (erc-with-all-buffers-of-server cproc nil |
| 666 | (when erc-server-ping-handler | 666 | (setq erc-server-connected nil)) |
| 667 | (progn (erc-cancel-timer erc-server-ping-handler) | 667 | (when erc-server-ping-handler |
| 668 | (setq erc-server-ping-handler nil))) | 668 | (progn (erc-cancel-timer erc-server-ping-handler) |
| 669 | (run-hook-with-args 'erc-disconnected-hook | 669 | (setq erc-server-ping-handler nil))) |
| 670 | (erc-current-nick) (system-name) "") | 670 | (run-hook-with-args 'erc-disconnected-hook |
| 671 | ;; Remove the prompt | 671 | (erc-current-nick) (system-name) "") |
| 672 | (goto-char (or (marker-position erc-input-marker) (point-max))) | 672 | ;; Remove the prompt |
| 673 | (forward-line 0) | 673 | (goto-char (or (marker-position erc-input-marker) (point-max))) |
| 674 | (erc-remove-text-properties-region (point) (point-max)) | 674 | (forward-line 0) |
| 675 | (delete-region (point) (point-max)) | 675 | (erc-remove-text-properties-region (point) (point-max)) |
| 676 | ;; Decide what to do with the buffer | 676 | (delete-region (point) (point-max)) |
| 677 | ;; Restart if disconnected | 677 | ;; Decide what to do with the buffer |
| 678 | (erc-process-sentinel-1 event buf))))) | 678 | ;; Restart if disconnected |
| 679 | (erc-process-sentinel-1 event buf)))))) | ||
| 679 | 680 | ||
| 680 | ;;;; Sending messages | 681 | ;;;; Sending messages |
| 681 | 682 | ||