help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to prevent Gnus from losing connection with nnimap?


From: Jean Magnan de Bornier
Subject: Re: How to prevent Gnus from losing connection with nnimap?
Date: Fri, 06 Mar 2009 08:42:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

"Sven Bretfeld" <address@hidden> wrote :

| Hello
>
| I'm using Gnus to read emails via IMAP. Every 5 minutes or so Gnus loses
| the connection to the server. 

Do you mean it loses the internet connection? If so, it is your machine,
not emacs. Otherwise, gnus needs to connect to your IMAP server only when
it checks mail, and that can be configured. And anyway gnus can work
without being connected to the internet and prepare messages to be sent
later. Have a look at the "Gnus unplugged" entry of the manual.


| So, it's impossible to let a Gnus instance run for a longer time. Even
| if I compose a longer message I have to save it in the drafts folder,
| close Gnus and start it again, before I can send the message.
>
| Is there any way to automatically refresh the connection every few
| minutes?

Well, I have this in my .gnus file (found on the net someday); for groups
with level=2 it makes an automatic check:

=======================================
(defun gnus-demon-scan-mail-or-news-and-update (level)
 "Recherche de news et mail, mise à jour du tampon *Group*."
   (let ((win (current-window-configuration)))
     (unwind-protect
         (save-window-excursion
      (save-excursion
             (when (gnus-alive-p)
               (save-excursion
                 (set-buffer gnus-group-buffer)
                 (gnus-group-get-new-news level)))))
       (set-window-configuration win))))

; level 2: only mail groups are scanned.
  (defun gnus-demon-scan-mail-and-update ()
  "Scan for new mail, updating the *Group* buffer."
    (gnus-demon-scan-mail-or-news-and-update 2))
  (gnus-demon-add-handler 'gnus-demon-scan-mail-and-update 5 nil)
;; ;;

(defun my-check-mail ()
  "Fetch new mails only."
  (gnus-group-get-new-news 2))

(add-hook 'gnus-startup-hook
          '(lambda ()
             (gnus-demon-add-handler 'my-check-mail 2 0)))
======================================

hth,
-- 
Jean


reply via email to

[Prev in Thread] Current Thread [Next in Thread]