* [PATCH] Fix ERC automatic re-connection behavior...
@ 2017-03-30 19:38 Victor J. Orlikowski
0 siblings, 0 replies; only message in thread
From: Victor J. Orlikowski @ 2017-03-30 19:38 UTC (permalink / raw)
To: emacs-devel
The existing code to handle automatic re-connection in ERC only runs
once, then exits. The following patch ensures that re-connection
behavior functions as-documented.
From 21cde8f74d61d0e30f37f74b6d4084f3159dfdcd Mon Sep 17 00:00:00 2001
From: "Victor J. Orlikowski" <vjo@duke.edu>
Date: Thu, 30 Mar 2017 13:12:55 -0400
Subject: [PATCH 1/2] Fix auto-reconnect to work properly again.
---
lisp/erc/erc-backend.el | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 8eac2e1..b30c484 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -607,10 +607,20 @@ Make sure you are in an ERC buffer when running this."
(erc-open erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password)))))
-(defun erc-server-delayed-reconnect (buffer)
- (if (buffer-live-p buffer)
- (with-current-buffer buffer
- (erc-server-reconnect))))
+(defun erc-server-background-reconnect (buffer)
+ (condition-case err
+ (progn
+ (setq erc-server-reconnecting nil
+ erc-server-reconnect-count (1+ erc-server-reconnect-count))
+ (if (buffer-live-p buffer)
+ (with-current-buffer buffer
+ (erc-server-reconnect))))
+ (error (unless (integerp erc-server-reconnect-attempts)
+ (message "%s ... %s"
+ "Reconnecting until we succeed"
+ "kill the ERC server buffer to stop"))
+ (run-at-time erc-server-reconnect-timeout nil
+ #'erc-server-background-reconnect buffer))))
(defun erc-server-filter-function (process string)
"The process filter for the ERC server."
@@ -676,18 +686,8 @@ EVENT is the message received from the closed connection process."
(erc-update-mode-line)
(set-buffer-modified-p nil))
;; reconnect
- (condition-case nil
- (progn
- (setq erc-server-reconnecting nil
- erc-server-reconnect-count (1+ erc-server-reconnect-count))
- (setq delay erc-server-reconnect-timeout)
- (run-at-time delay nil
- #'erc-server-delayed-reconnect buffer))
- (error (unless (integerp erc-server-reconnect-attempts)
- (message "%s ... %s"
- "Reconnecting until we succeed"
- "kill the ERC server buffer to stop"))
- (erc-server-delayed-reconnect buffer))))))))
+ (run-at-time nil nil
+ #'erc-server-background-reconnect buffer))))))
(defun erc-process-sentinel-1 (event buffer)
"Called when `erc-process-sentinel' has decided that we're disconnecting.
--
2.10.1 (Apple Git-78)
Best,
Victor
--
Victor J. Orlikowski <> victor.j.orlikowski@alumni.duke.edu
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-30 19:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-30 19:38 [PATCH] Fix ERC automatic re-connection behavior Victor J. Orlikowski
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.