Gnus development mailing list
 help / color / mirror / Atom feed
* demons and handlers
@ 1999-09-25 17:09 Harry Putnam
  1999-09-26  2:38 ` Karl Kleinpaste
  0 siblings, 1 reply; 5+ messages in thread
From: Harry Putnam @ 1999-09-25 17:09 UTC (permalink / raw)



I've never been able to figure out the demon/handler syntax enough to
get much use from it.

Using a function posted by Larsi a while back, I want to run this
function every 5 minutes while online.  

Rather than try for sophisticated code to check for onlinedness or
whatever, probably easier to just eval the code when going online and
"uneval" it when going off.  (not sure how to uneval code either but
seems one could)

The function allows an online gnus to exchange information with an
offline gnus:

 (defun lars-fetch-news ()
   (interactive)
   (push "/usr/local/pgnus-0.96/lisp" load-path)
   (let ((init-file-user "")
 	(gnus-always-read-dribble-file t))
     (gnus))
   (gnus-group-send-drafts)
   (gnus-agent-fetch-session)
   (gnus-group-quit))


I'd like to run this every 5 minutes.   How would this be accomplished?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: demons and handlers
  1999-09-25 17:09 demons and handlers Harry Putnam
@ 1999-09-26  2:38 ` Karl Kleinpaste
  1999-09-26 15:53   ` Harry Putnam
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Kleinpaste @ 1999-09-26  2:38 UTC (permalink / raw)


(gnus-demon-add-handler 'lars-fetch-news 5 nil)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: demons and handlers
  1999-09-26  2:38 ` Karl Kleinpaste
@ 1999-09-26 15:53   ` Harry Putnam
  1999-09-26 16:54     ` Kai Großjohann
  0 siblings, 1 reply; 5+ messages in thread
From: Harry Putnam @ 1999-09-26 15:53 UTC (permalink / raw)


Karl Kleinpaste <karl@justresearch.com> writes:

> (gnus-demon-add-handler 'lars-fetch-news 5 nil)

Thanks Karl,

Er ... I think I'm trying to do something foolish here..

Lars function closes gnus down when finished.  Should your line above
work with just emacs running?  I've evaled (C-xC-e) in  a scatch
buffer of a running gnus ..."nil" is reported in the echo area,
the deed is done, then shutdown.  And of course this function depends
on gnus shutting down to write the .newsrc.eld that the offline gnus
needs to read. (I think)

How would one go about overcoming this aspect and run the code in a
running emacs, periodically?

 (defun lars-fetch-news ()
   (interactive)
   (push "/usr/local/pgnus-0.96/lisp" load-path)
   (let ((init-file-user "")
 	(gnus-always-read-dribble-file t))
     (gnus))
   (gnus-group-send-drafts)
   (gnus-agent-fetch-session)
   (gnus-group-quit))


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: demons and handlers
  1999-09-26 15:53   ` Harry Putnam
@ 1999-09-26 16:54     ` Kai Großjohann
  1999-09-27  5:36       ` Harry Putnam
  0 siblings, 1 reply; 5+ messages in thread
From: Kai Großjohann @ 1999-09-26 16:54 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:

>  (defun lars-fetch-news ()
>    (interactive)
>    (push "/usr/local/pgnus-0.96/lisp" load-path)
>    (let ((init-file-user "")
>  	(gnus-always-read-dribble-file t))
>      (gnus))
>    (gnus-group-send-drafts)
>    (gnus-agent-fetch-session)
>    (gnus-group-quit))

This looks as if it was intended to be run from the command line, like
``emacs -batch -f lars-fetch-news''.

For periodically checking for new mail, I think there are some
ready-made functions.  Load gnus-demon.el and then look for functions
starting with gnus-demon.  gnus-demon-add-scanmail and
gnus-demon-add-rescan look promising, judging solely from their
names. 

kai
-- 
I like BOTH kinds of music.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: demons and handlers
  1999-09-26 16:54     ` Kai Großjohann
@ 1999-09-27  5:36       ` Harry Putnam
  0 siblings, 0 replies; 5+ messages in thread
From: Harry Putnam @ 1999-09-27  5:36 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> Harry Putnam <reader@newsguy.com> writes:
> 
> >  (defun lars-fetch-news ()
> >    (interactive)
> >    (push "/usr/local/pgnus-0.96/lisp" load-path)
> >    (let ((init-file-user "")
> >  	(gnus-always-read-dribble-file t))
> >      (gnus))
> >    (gnus-group-send-drafts)
> >    (gnus-agent-fetch-session)
> >    (gnus-group-quit))
> 
> This looks as if it was intended to be run from the command line, like
> ``emacs -batch -f lars-fetch-news''.

[...] snip

I hadn't really thought to use it in batch mode but now that you
mention it, it does work well that way.  I think even better than some
scanning fucntion.  This way I was able to set a simple keyboard
sequence to run a batch command and this function, while having an
off-line (machine is online of course) gnus running that I read and
post from.  So by pressing a couple keys , I can call the above
functionn in batch mode then view the results in the off-line gnus by
pressing 'g'.   The running gnus never goes online.   Nice.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-09-27  5:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-25 17:09 demons and handlers Harry Putnam
1999-09-26  2:38 ` Karl Kleinpaste
1999-09-26 15:53   ` Harry Putnam
1999-09-26 16:54     ` Kai Großjohann
1999-09-27  5:36       ` Harry Putnam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).