[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117079: Optionally auto-reconnect depending on `rci
From: |
Sam Steingold |
Subject: |
[Emacs-diffs] trunk r117079: Optionally auto-reconnect depending on `rcirc-reconnect-delay'. |
Date: |
Fri, 09 May 2014 17:04:58 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117079
revision-id: address@hidden
parent: address@hidden
committer: Sam Steingold <address@hidden>
branch nick: trunk
timestamp: Fri 2014-05-09 13:04:46 -0400
message:
Optionally auto-reconnect depending on `rcirc-reconnect-delay'.
* net/rcirc.el (rcirc-reconnect-delay): New user option.
(rcirc-sentinel): Auto-reconnect to the server if `rcirc-reconnect-delay'
is non-0 (but not more often than its value in case the host is off-line).
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/net/rcirc.el rcirc.el-20091113204419-o5vbwnq5f7feedwu-4032
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-05-09 09:10:56 +0000
+++ b/lisp/ChangeLog 2014-05-09 17:04:46 +0000
@@ -1,3 +1,10 @@
+2014-05-08 Sam Steingold <address@hidden>
+
+ * net/rcirc.el (rcirc-reconnect-delay): New user option.
+ (rcirc-sentinel): Auto-reconnect to the server if
+ `rcirc-reconnect-delay' is non-0 (but not more often than its
+ value in case the host is off-line).
+
2014-05-09 Eli Zaretskii <address@hidden>
* progmodes/grep.el (lgrep): Fix a typo in last commit.
=== modified file 'lisp/net/rcirc.el'
--- a/lisp/net/rcirc.el 2014-04-09 13:37:49 +0000
+++ b/lisp/net/rcirc.el 2014-05-09 17:04:46 +0000
@@ -658,6 +658,15 @@
"Hook functions called when the process sentinel is called.
Functions are called with PROCESS and SENTINEL arguments.")
+(defcustom rcirc-reconnect-delay 0
+ "*The minimum interval in seconds between reconnect attempts.
+When 0, do not auto-reconnect."
+ :type 'integer
+ :group 'rcirc)
+
+(defvar rcirc-last-connect-time nil
+ "The last time the buffer was connected.")
+
(defun rcirc-sentinel (process sentinel)
"Called when PROCESS receives SENTINEL."
(let ((sentinel (replace-regexp-in-string "\n" "" sentinel)))
@@ -671,6 +680,14 @@
sentinel
(process-status process)) (not rcirc-target))
(rcirc-disconnect-buffer)))
+ (when (and (string= sentinel "deleted")
+ (< 0 rcirc-reconnect-delay))
+ (let ((now (current-time)))
+ (when (or (null rcirc-last-connect-time)
+ (< rcirc-reconnect-delay
+ (float-time (time-subtract now
rcirc-last-connect-time))))
+ (setq sds-rcirc-sentinel-last now)
+ (rcirc-cmd-reconnect nil))))
(run-hook-with-args 'rcirc-sentinel-functions process sentinel))))
(defun rcirc-disconnect-buffer (&optional buffer)
@@ -1007,6 +1024,7 @@
(setq-local fill-paragraph-function 'rcirc-fill-paragraph)
(setq-local rcirc-recent-quit-alist nil)
(setq-local rcirc-current-line 0)
+ (setq-local rcirc-last-connect-time (current-time))
(use-hard-newlines t)
(setq-local rcirc-short-buffer-name nil)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117079: Optionally auto-reconnect depending on `rcirc-reconnect-delay'.,
Sam Steingold <=