all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: Leo Liu <sdl.web@gmail.com>
Cc: 17045@debbugs.gnu.org
Subject: bug#17045: 24.3.50; feature request: rcirc-reconnect
Date: Wed, 07 May 2014 13:57:06 -0400	[thread overview]
Message-ID: <m2bnv95v65.fsf@gnu.org> (raw)
In-Reply-To: <m3mwfwi5kh.fsf@gmail.com> (Leo Liu's message of "Tue, 08 Apr 2014 16:33:18 +0800")

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.





  parent reply	other threads:[~2014-05-07 17:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20  2:33 bug#17045: 24.3.50; feature request: rcirc-reconnect Sam Steingold
2014-04-08  8:33 ` Leo Liu
2014-04-08  9:33   ` Daimrod
2014-04-08 11:52     ` Leo Liu
2014-04-08 14:03       ` Daimrod
2014-04-09 21:17         ` Sam Steingold
2014-04-10  0:47           ` Daimrod
2014-04-10  4:41             ` Leo Liu
2014-04-10  5:07               ` Daimrod
2014-04-09 21:22   ` Sam Steingold
2014-05-07 17:57   ` Sam Steingold [this message]
2014-05-08  1:58     ` Leo Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2bnv95v65.fsf@gnu.org \
    --to=sds@gnu.org \
    --cc=17045@debbugs.gnu.org \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.