[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17045: 24.3.50; feature request: rcirc-reconnect
From: |
Sam Steingold |
Subject: |
bug#17045: 24.3.50; feature request: rcirc-reconnect |
Date: |
Wed, 07 May 2014 13:57:06 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin) |
Hi Leo,
> * Leo Liu <fqy.jro@tznvy.pbz> [2014-04-08 16:33:18 +0800]:
>
> On 2014-03-20 10:33 +0800, Sam Steingold wrote:
>> It is not nice to have to do M-x rcirc whenever the connection dies.
>> Would it be possible to incorporate something similar to
>> http://www.emacswiki.org/emacs/rcircReconnect
>
> Would something like this suit your needs? Thanks for testing. - Leo
This indeed enables me to auto-reconnect like this:
--8<---------------cut here---------------start------------->8---
(defvar sds-rcirc-sentinel-last (current-time) "last reconnect attempt time")
(defun sds-rcirc-sentinel (process sentinel)
(let* ((now (current-time))
(delay (float-time (time-subtract (current-time)
sds-rcirc-sentinel-last))))
(message "%s sds-rcirc-sentinel: %s %s %s (last: %s, %s ago)"
(format-time-string "%F %R") process
(process-status process) sentinel
(format-time-string "%F %R" sds-rcirc-sentinel-last)
(sds-difftime-to-string delay))
(when (and (string= sentinel "deleted")
(< 60 delay)) ; do not try to reconnect more than once a minute
(setq sds-rcirc-sentinel-last now)
(rcirc-cmd-reconnect nil))))
(add-hook 'rcirc-sentinel-functions 'sds-rcirc-sentinel)
--8<---------------cut here---------------end--------------->8---
However, I would much prefer to enable auto-reconnect by a simple
(custom-set-variables '(rcirc-reconnect-interval 60))
where rcirc-reconnect-interval = 0 means the current behavior (no
auto-reconnect).
Do you mind if I commit something based on the above or would you like
to implement it yourself?
Thanks a lot for your help!
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1265
http://www.childpsy.net/ http://think-israel.org http://mideasttruth.com
http://pmw.org.il http://honestreporting.com
There is an exception to every rule, including this one.
- bug#17045: 24.3.50; feature request: rcirc-reconnect,
Sam Steingold <=