info-gnus-english
[Top][All Lists]
Advanced

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

SOLVED: Sending delayed articles when getting new news


From: Paul Johnson
Subject: SOLVED: Sending delayed articles when getting new news
Date: Thu, 05 Aug 2004 00:08:24 GMT
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

raphael.berbain@free.fr (Raphaël Berbain) writes:

> Paul Johnson <baloo@ursine.ca> writes:
>
>> Apologies for another idiot question, but is there a way to make Gnus
>> send any delayed articles scheduled to go out at or before the current
>> time automatically when one presses g for new news?
>
> If you mean basically automate 'J j' 'J S' 'g' 'J s' 'J j', then the
> basic functions you should play with are 'gnus-agent-toggle-plugged',
> 'gnus-group-send-queue, 'gnus-group-get-new-news',
> 'gnus-agent-fetch-session'.  If you don't, then I didn't understand
> what you meant by 'delayed articles scheduled...'.  My apologies !!

No, you slugged a homer clean over the fence there.

> As an example, below is what I use - It does what you ask and some
> more (I was lazy and didn't want to clean the code).  With this setup,
> 'd' gets mail & news, 'f' sends queue, 'g' gets only mail (since my
> mail backend is unagentized, but nntp is) and 'h' first sends, then
> gets.

Oooh, a grand slam!  Short answers are nice, brain dumps even better!

> ;;;; ** mail demon
>
> (defun rgb/gnus-demon-scan (function)
>   (let ((win (current-window-configuration)))
>     (unwind-protect
>       (save-window-excursion
>         (save-excursion
>           (when (gnus-alive-p)
>             (save-excursion
>               (set-buffer gnus-group-buffer)
>               (funcall function)))))
>       (set-window-configuration win))))
>
> (defun rgb/gnus-demon-scan-mail ()
>   (message "checking mail...")
>   (rgb/gnus-demon-scan 'gnus-group-get-new-news)
>   (message "checking mail... done. [%s]" (format-time-string "%r" 
> (current-time))))
>
> (defun rgb/gnus-demon-mail-start ()
>   (interactive)
>   (gnus-demon-add-handler    'rgb/gnus-demon-scan-mail 5 t))
>
> (defun rgb/gnus-demon-mail-stop ()
>   (interactive)
>   (gnus-demon-remove-handler 'rgb/gnus-demon-scan-mail))
>
> (add-hook 'gnus-started-hook            'rgb/gnus-demon-mail-start)
> (add-hook 'gnus-after-exiting-gnus-hook 'rgb/gnus-demon-mail-stop)
>
> ;;;; ** agent
>
> ;; (setq gnus-agent-synchronize-flags 'ask)
> (setq gnus-agent-synchronize-flags t)
>
> (defun rgb/gnus-demon-wrap (function)
>   (rgb/gnus-demon-mail-stop)
>   (funcall function)
>   (rgb/gnus-demon-mail-start))
>   
>
> (defun rgb/gnus-agent-wrap (function)
>   (gnus-agent-toggle-plugged t)
>   (funcall function)
>   (gnus-agent-toggle-plugged nil))  
>
> (defun rgb/gnus-agent-get-unplugged ()
>   (interactive)
>   (rgb/gnus-demon-wrap
>    (lambda ()
>      (message "checking mail...")
>      (gnus-group-get-new-news)
>      (message "checking mail... done. [%s]" (format-time-string "%r" 
> (current-time))))))
>
> (defun rgb/gnus-agent-get ()
>   (interactive)
>   (rgb/gnus-demon-wrap
>    (lambda ()
>      (rgb/gnus-agent-wrap
>       (lambda ()
>         (gnus-group-get-new-news)
>         (gnus-agent-fetch-session))))))
>
> (defun rgb/gnus-agent-put ()
>   (interactive)
>   (rgb/gnus-demon-wrap
>    (lambda ()
>      (rgb/gnus-agent-wrap
>       (lambda ()
>         (gnus-group-send-queue))))))
>
> (defun rgb/gnus-agent-put-get ()
>   (interactive)
>   (rgb/gnus-demon-wrap
>    (lambda ()
>      (rgb/gnus-agent-wrap
>       (lambda ()
>         (gnus-group-send-queue)
>         (gnus-group-get-new-news)
>         (gnus-agent-fetch-session))))))
>
> (keydef (gnus-group "d") rgb/gnus-agent-get)
> (keydef (gnus-group "f") rgb/gnus-agent-put)
> (keydef (gnus-group "g") rgb/gnus-agent-get-unplugged)
> (keydef (gnus-group "h") rgb/gnus-agent-put-get)

Attachment: pgpvHRjvbdJ5n.pgp
Description: PGP signature


reply via email to

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