Re: Problem trying to get new email every 10 minutes automatically

2015-10-19 Thread Emanuel Berg
Brady Trainor  writes:

> The following,
>
> #+BEGIN_SRC elisp
> (setq gnus-demon-handlers nil)
> (setq gnus-demon-timestep 5)
> (gnus-demon-add-handler (lambda ()
>   (message "hello"))
> 1 nil)
> #+END_SRC
>
> works for me.

Thank you. Indeed, this works for me.

(require 'gnus-demon)
(require 'cl-lib)
(defvar *its*)
(setq *its* 0)
(setq gnus-demon-timestep 1)
(gnus-demon-add-handler (lambda ()
  (cl-incf *its*)
  (message "hello: %s" *its*))
1 nil)

Perhaps it was the `gnus-demon-timestep' that did it.
(Note: if anyone can't get to the help of that
variable, do (require 'gnus-demon) first. FWR this
isn't necessary to get the help of
`gnus-demon-add-handler', even tho that is also
defined in gnus-demon.el).

-- 
underground experts united
http://user.it.uu.se/~embe8573


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Brady Trainor

David Hume  writes:

> cseber...@gmail.com writes:
>
>>
>> (gnus-demon-add-handler 'gnus-demon-scan-news 10 t)
>
> My guess is it is using run-with-idle-timer which behaves differently
> from what you would expect. If you do nothing in emacs for 10 minutes it
> might get mail. But if you press a key the timer is reset. Also I think
> after it has got mail it doesn't set the idle timer going again unless
> you do something.
>
[...]

Right, "If IDLE is t, only call each time Emacs has been idle for TIME." from, 

,[ C-h v gnus-demon-handlers RET ]
| gnus-demon-handlers is a variable defined in `gnus-demon.el'.
| Its value is nil
| 
| Documentation:
| Alist of daemonic handlers to be run at intervals.
| Each handler is a list on the form
| 
| (FUNCTION TIME IDLE)
| 
| FUNCTION is the function to be called.  TIME is the number of
| `gnus-demon-timestep's between each call.
| If nil, never call. If t, call each `gnus-demon-timestep'.
| 
| If IDLE is t, only call each time Emacs has been idle for TIME.
| If IDLE is a number, only call when Emacs has been idle more than
| this number of `gnus-demon-timestep's.
| If IDLE is nil, don't care about idleness.
| If IDLE is a number and TIME is nil, then call once each time
| Emacs has been idle for IDLE `gnus-demon-timestep's.
| 
| You can customize this variable.
| 
| [back]
`

--
Brady


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Brady Trainor

Emanuel Berg  writes:

> I'm not getting it to work either:

[...]

> The function doesn't get called.

The following, 

#+BEGIN_SRC elisp
(setq gnus-demon-handlers nil)
(setq gnus-demon-timestep 5)
(gnus-demon-add-handler (lambda ()
  (message "hello"))
1 nil)
#+END_SRC

works for me.

--
Brady


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Emanuel Berg
cseber...@gmail.com writes:

> What ever comes standard with Emacs24 (Ubuntu 14.04
> distro package).

In a message buffer body, do

C-u M-x gnus-version RET

-- 
underground experts united
http://user.it.uu.se/~embe8573


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread cseberino

> What is your Gnus version?

What ever comes standard with Emacs24 (Ubuntu 14.04 distro package).

cs
___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Random832
David Hume  writes:
> Random832  writes:
>> What about emacsclient -e '(gnus-group-get-new-news)'? That seems like
>> it would be more robust than sending an interactive keypress.
>
> I am not sure what that does.

Provided that your emacs has server mode enabled and gnus loaded, it
will cause it to execute the same function as "g".

It has the advantage that you don't have to do anything special
(i.e. whatever you're doing with screen) to make it send keypresses to
emacs, and to make sure that the group buffer is active when it does.


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Emanuel Berg
a...@koldfront.dk (Adam Sjøgren) writes:

> "idle" does mean "you haven't touched Emacs at all".

What should you have as the IDLE argument if you want
something to happen every (say) five minutes
*regardless* of input?

With the conventional assumption there ain't
relentless input, of course.

-- 
underground experts united
http://user.it.uu.se/~embe8573


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Random832
David Hume  writes:
> There might be a way of doing what you want in emacs, but I did it using
> the screen command from bash command line and running a script to send
> 'g'.

What about emacsclient -e '(gnus-group-get-new-news)'? That seems like
it would be more robust than sending an interactive keypress.


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Adam Sjøgren
cseber...@gmail.com writes:

> The last line below of my Gnus config I assumed was to grab new email
> every 10 minutes. I sent an email to my Gmail account and noticed it
> showed up in my other non-Emacs email client inbox but not in Gnus
> inbox. Why?

I'm using this, which works for me:

  ; Demon to fetch email every 5 minutes when Emacs has been idle for 5 minutes:
  (gnus-demon-add-handler 'gnus-demon-scan-news 5 5)
  ; Demon to send queued email every other minute:
  (gnus-demon-add-handler 'gnus-delay-send-queue 1 nil)
  (gnus-demon-init)

"idle" does mean "you haven't touched Emacs at all".


  Best regards,

Adam

-- 
 "Och när jag blundar hörs din röst   Adam Sjøgren
  Jag kan inte se ditt ansikte   a...@koldfront.dk
  Det var det jag glömde först"


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Emanuel Berg
David Hume  writes:

> My guess is it is using run-with-idle-timer which
> behaves differently from what you would expect. If you
> do nothing in emacs for 10 minutes it might get mail.
> But if you press a key the timer is reset.
> Also I think after it has got mail it doesn't set the
> idle timer going again unless you do something.

I'm not getting it to work either:

(require 'cl)
(require 'gnus-demon)

(defvar *its*)
(setq *its* 0)

(gnus-demon-add-handler
 (lambda ()
   (incf *its*)
   (message "One second! %s" (make-string *its* ?.)) )
 1
 nil) ; IDLE; run every second regardless of user input

The function doesn't get called.

-- 
underground experts united
http://user.it.uu.se/~embe8573


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Problem trying to get new email every 10 minutes automatically

2015-10-18 Thread Peter Münster
On Sat, Oct 17 2015, cseber...@gmail.com wrote:

> (gnus-demon-add-handler 'gnus-demon-scan-news 10 t)

What is your Gnus version?

-- 
   Peter


___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english


Problem trying to get new email every 10 minutes automatically

2015-10-17 Thread cseberino
The last line below of my Gnus config I assumed was to grab new email every 10 
minutes.  I sent an email to my Gmail account and noticed it showed up in my 
other non-Emacs email client inbox but not in Gnus inbox.  Why?

(If I type "g" manually in Gnus then it DOES get new email!?!?)

cs


(setq-default gnus-permanently-visible-groups ".*.*")

(require 'nnir)
(setq-default gnus-select-method
  '(nnimap "gmail"
   (nnimap-address "imap.googlemail.com")
   (nnimap-server-port "imaps")
   (nnimap-stream ssl)
   (nnir-search-engine imap)))

(setq-default smtpmail-smtp-service 587
  gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")

(setq-default gnus-posting-styles
  '(((header "to" "REDACTED")
 (address "REDACTED"))
((header "to" "REDACTED")
 (address "REDACTED"))
((header "to" "REDACTED")
 (address "REDACTED"

(setq-default user-mail-address  "REDACTED")
(setq-default user-full-name "REDACTED")
(setq-default smtpmail-smtp-server   "smtp.googlemail.com")
(setq-default send-mail-function 'smtpmail-send-it)
(setq-default message-send-mail-function 'smtpmail-send-it)

(gnus-demon-add-handler 'gnus-demon-scan-news 10 t)
___
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english