* diary-mail-entries
@ 2007-03-20 21:49 sven.bretfeld
2007-03-21 4:45 ` diary-mail-entries Kevin Rodgers
0 siblings, 1 reply; 11+ messages in thread
From: sven.bretfeld @ 2007-03-20 21:49 UTC (permalink / raw)
To: help-gnu-emacs
Hello list
I'm trying to set up a cron job sending me the entries of the Emacs
diary every morning, just as described in
http://www.emacswiki.org/cgi-bin/wiki/DiaryMode#DiaryMode3
It's not working, since the mail sent by the script doesn't contain
all of the entries of my diary file. It contains almost only
automatical entries like holidays. A few personal entries are
included, however, about two out of 20. Does anybody have an idea
what's going wrong here?
I add the script and my settings below.
Thanks for help
Sven
------------
Here is the script (it's one line in the original; I tried 50 days
just to see if any entry is caught at all, it should be 7 or less
after I got it working):
#!/bin/bash
emacs --batch --eval "(setq diary-mail-days 50 european-calendar-style
t diary-file \"~/aktuell/myconf/diary\" diary-mail-addr
\"sven.bretfeld@relwi.unibe.ch\")" -l diary-lib -f diary-mail-entries
And here are the diary-settings of my .emacs:
(setq diary-file "~/aktuell/myconf/diary")
;; Europäisch
(setq european-calendar-style 't)
(setq calendar-week-start-day 1
calendar-day-name-array
["Sonntag" "Montag" "Dienstag" "Mittwoch"
"Donnerstag" "Freitag" "Samstag"]
calendar-month-name-array
["Januar" "Februar" "März" "April" "Mai"
"Juni" "Juli" "August" "September"
"Oktober" "November" "Dezember"])
;; Start with diary (if there is an entry today)
(diary)
;; Timer
(display-time)
(add-hook 'diary-hook 'appt-make-list)
(diary 0)
;; LaTeX output des Kalenders
(setq cal-tex-diary 't)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: diary-mail-entries
2007-03-20 21:49 diary-mail-entries sven.bretfeld
@ 2007-03-21 4:45 ` Kevin Rodgers
0 siblings, 0 replies; 11+ messages in thread
From: Kevin Rodgers @ 2007-03-21 4:45 UTC (permalink / raw)
To: help-gnu-emacs
sven.bretfeld@gmx.ch wrote:
> Hello list
>
> I'm trying to set up a cron job sending me the entries of the Emacs
> diary every morning, just as described in
>
> http://www.emacswiki.org/cgi-bin/wiki/DiaryMode#DiaryMode3
>
> It's not working, since the mail sent by the script doesn't contain
> all of the entries of my diary file. It contains almost only
> automatical entries like holidays. A few personal entries are
> included, however, about two out of 20. Does anybody have an idea
> what's going wrong here?
>
> I add the script and my settings below.
>
> Thanks for help
> Sven
>
> ------------
>
> Here is the script (it's one line in the original; I tried 50 days
> just to see if any entry is caught at all, it should be 7 or less
> after I got it working):
>
> #!/bin/bash
> emacs --batch --eval "(setq diary-mail-days 50 european-calendar-style
> t diary-file \"~/aktuell/myconf/diary\" diary-mail-addr
> \"sven.bretfeld@relwi.unibe.ch\")" -l diary-lib -f diary-mail-entries
You are probably aware that --batch implies --no-init-file, which means
your personal .emacs and installation's default.el files are not loaded.
Rather than partially replicating the contents of those files with
--eval etc., why not explicitly load them:
emacs --batch --load ~/.emacs --load default.el --funcall diary-mail-entries
> And here are the diary-settings of my .emacs:
>
> (setq diary-file "~/aktuell/myconf/diary")
>
> ;; Europäisch
> (setq european-calendar-style 't)
> (setq calendar-week-start-day 1
> calendar-day-name-array
> ["Sonntag" "Montag" "Dienstag" "Mittwoch"
> "Donnerstag" "Freitag" "Samstag"]
> calendar-month-name-array
> ["Januar" "Februar" "März" "April" "Mai"
> "Juni" "Juli" "August" "September"
> "Oktober" "November" "Dezember"])
>
> ;; Start with diary (if there is an entry today)
> (diary)
>
> ;; Timer
> (display-time)
> (add-hook 'diary-hook 'appt-make-list)
> (diary 0)
>
> ;; LaTeX output des Kalenders
> (setq cal-tex-diary 't)
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 11+ messages in thread
* diary-mail-entries
@ 2022-10-13 16:53 aalinovi
2022-10-13 17:31 ` diary-mail-entries Thorsten Bonow
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: aalinovi @ 2022-10-13 16:53 UTC (permalink / raw)
To: help-gnu-emacs
I am running emacs-28.2 on OpenBSD-current. I will state at the outset
that I do no know lisp but have acquired a copy of Robert Chassell's
"Emacs Lisp: An Introduction" and have started going thru it.
After several hours of experimenting I have finally got M-x
diary-mail-entries to work. What I now need is to enable that in a cron
job to run each night. Not knowing lisp I have no idea where or how to
begin.
Any assistance would be appreciated.
Thank you.
Arthur
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: diary-mail-entries
2022-10-13 16:53 diary-mail-entries aalinovi
@ 2022-10-13 17:31 ` Thorsten Bonow
2022-10-13 19:21 ` diary-mail-entries Emanuel Berg
2022-10-13 19:23 ` diary-mail-entries Emanuel Berg
2 siblings, 0 replies; 11+ messages in thread
From: Thorsten Bonow @ 2022-10-13 17:31 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> aalinovi <aalinovi@riseup.net> writes:
> I am running emacs-28.2 on OpenBSD-current. I will state at the outset that I
> do no know lisp but have acquired a copy of Robert Chassell's "Emacs Lisp: An
> Introduction" and have started going thru it.
> After several hours of experimenting I have finally got M-x
> diary-mail-entries to work. What I now need is to enable that in a cron job
> to run each night. Not knowing lisp I have no idea where or how to begin.
> Any assistance would be appreciated. Thank you. Arthur
Hi,
short answer, pressed for time: The help for `diary-mail-entries' has an example script: "C-h f diary-mail-entries".
But I think this can be handled by the "midnight.el" library, already included: "run something every midnight, e.g., kill old buffers".
More time next week. Hope this helps. Don't forget the excellent GNU Emacs
manual...
Toto
--
Sent from my GNU Emacs running on GNU/Linux
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: diary-mail-entries
2022-10-13 16:53 diary-mail-entries aalinovi
2022-10-13 17:31 ` diary-mail-entries Thorsten Bonow
@ 2022-10-13 19:21 ` Emanuel Berg
2022-10-13 19:23 ` diary-mail-entries Emanuel Berg
2 siblings, 0 replies; 11+ messages in thread
From: Emanuel Berg @ 2022-10-13 19:21 UTC (permalink / raw)
To: help-gnu-emacs
aalinovi wrote:
> I am running emacs-28.2 on OpenBSD-current. I will state at
> the outset that I do no know lisp but have acquired a copy
> of Robert Chassell's "Emacs Lisp: An Introduction" and have
> started going thru it.
Good, reading is always good, but write code from day 0 ...
> After several hours of experimenting I have finally got M-x
> diary-mail-entries to work. What I now need is to enable
> that in a cron job to run each night.
You can run an Elisp file like a shell script (not literally),
with Emacs,
$ emacs --batch --load FILE
I'd recommend making that work _in_ Emacs first, then as
above, only the third step would be from cron ...
Here is an example, with emphasis on AN example, not saying
it's a GOOD example of program design ...
https://dataswamp.org/~incal/emacs-init/piles.el
https://dataswamp.org/~incal/hits/hits.gpi
https://dataswamp.org/~incal/piles-all
With
$ crontab -l
30 2 * * * /home/incal/public_html/hits/piles-all; /home/incal/public_html/hits/hits.gpi
It's a cool pic anyway :)
https://dataswamp.org/~incal/hits/hits.png
> Not knowing lisp I have no idea where or how to begin.
If you feel you don't know enough Lisp start with things at
a level where you can get going ... those very small programs
don't have to be useful. Typically you don't have to write so
many of those before you can actually start with things that
are simple yes but actually useful as well.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: diary-mail-entries
2022-10-13 16:53 diary-mail-entries aalinovi
2022-10-13 17:31 ` diary-mail-entries Thorsten Bonow
2022-10-13 19:21 ` diary-mail-entries Emanuel Berg
@ 2022-10-13 19:23 ` Emanuel Berg
2 siblings, 0 replies; 11+ messages in thread
From: Emanuel Berg @ 2022-10-13 19:23 UTC (permalink / raw)
To: help-gnu-emacs
aalinovi wrote:
> I am running emacs-28.2 on OpenBSD-current
Cool BTW, a hacker system, alltho I'm not a minimalist guy
myself but a maximalist so I use Linux ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: diary-mail-entries
@ 2022-10-14 13:42 aalinovi
2022-10-16 20:31 ` diary-mail-entries Thorsten Bonow
0 siblings, 1 reply; 11+ messages in thread
From: aalinovi @ 2022-10-14 13:42 UTC (permalink / raw)
To: help-gnu-emacs
It appears I spoke to soon.
In ~/.emacs.d/init.el I have:
(require 'midnight)
(midnight-delay-set 'midnight-delay "0:40am")
In midnight customization, the only thing I changed was to add
"diary-mail-entries" to "Midnight hook".
My problem is that not only does dairy-mail-entry run at 40 minutes
after midnight, it also runs each and everytime I start emacs.
I know some people keep emacs running for weeks or even months at a
time. I don't work like that. I am retired and use my laptop to browse
the web, read emails, etc. When I'm done I shut down and then boot up
later in the day if I feel like it. Having emacs send me an email each
time is not what I want.
If anyone has any ideas I would be grateful.
Thanks,
Arthur
aalinovi@riseup.net writes:
>Thorsten Bonow <thorsten.bonow@post.rwth-aachen.de> writes:
>>>>>> aalinovi <aalinovi@riseup.net> writes:
>
>> I am running emacs-28.2 on OpenBSD-current. I will state at the outset t=
>hat I
>> do no know lisp but have acquired a copy of Robert Chassell's "Emacs Lis=
>p: An
>> Introduction" and have started going thru it.
>
>> After several hours of experimenting I have finally got M-x
>> diary-mail-entries to work. What I now need is to enable that in a cron =
>job
>> to run each night. Not knowing lisp I have no idea where or how to begin=
>.
>
>> Any assistance would be appreciated. Thank you. Arthur
>
>>>Hi,
>
>>>short answer, pressed for time: The help for `diary-mail-entries' has
>>>an example script: "C-h f diary-mail-entries".
>
>>>But I think this can be handled by the "midnight.el" library, already
>>>included: "run something every midnight, e.g., kill old buffers".
>
>I couldn't get the example script to run but I did get "midnight.el"
>(which I didn't even know existed) to work.
>
>Thank you very much.
>
>Arthur
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: diary-mail-entries
2022-10-14 13:42 diary-mail-entries aalinovi
@ 2022-10-16 20:31 ` Thorsten Bonow
2022-10-17 11:21 ` diary-mail-entries aalinovi
0 siblings, 1 reply; 11+ messages in thread
From: Thorsten Bonow @ 2022-10-16 20:31 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> aalinovi <aalinovi@riseup.net> writes:
> It appears I spoke to soon. In ~/.emacs.d/init.el I have:
> (require 'midnight) (midnight-delay-set 'midnight-delay "0:40am")
> In midnight customization, the only thing I changed was to add
> "diary-mail-entries" to "Midnight hook".
> My problem is that not only does dairy-mail-entry run at 40 minutes after
> midnight, it also runs each and everytime I start emacs.
Hi,
that's because you told GNU Emacs to do so :-)
There are two ways of setting the delay:
`midnight-delay-set' accepts a number as second arg, specifying the number of
seconds after the midnight when the midnight-timer is run. So
(midnight-delay-set 'midnight-delay 2400) would have done the trick.
You chose to use the other way by passing a string, which is then passed as the
first argument to `run-at-time'. But for `run-at-time', if the time is
specified using a string, it is taken to be a time _today_, even if already in
the past. So I bet you fired up Emacs after 0:40am and then midnight runs
immediately.
You can read about this in the GNU Emacs Lisp manual, see "Timers".
Hope this helps,
Toto
> I know some people keep emacs running for weeks or even months at a time. I
> don't work like that. I am retired and use my laptop to browse the web, read
> emails, etc. When I'm done I shut down and then boot up later in the day if I
> feel like it. Having emacs send me an email each time is not what I want.
> If anyone has any ideas I would be grateful.
> Thanks,
> Arthur
> aalinovi@riseup.net writes:
>> Thorsten Bonow <thorsten.bonow@post.rwth-aachen.de> writes:
>>>>>>> aalinovi <aalinovi@riseup.net> writes:
>>
>>> I am running emacs-28.2 on OpenBSD-current. I will state at the outset t=
>> hat I
>>> do no know lisp but have acquired a copy of Robert Chassell's "Emacs Lis=
>> p: An
>>> Introduction" and have started going thru it.
>>
>>> After several hours of experimenting I have finally got M-x
>>> diary-mail-entries to work. What I now need is to enable that in a cron =
>> job
>>> to run each night. Not knowing lisp I have no idea where or how to begin=
>> .
>>
>>> Any assistance would be appreciated. Thank you. Arthur
>>
>>>> Hi,
>>
>>>> short answer, pressed for time: The help for `diary-mail-entries' has an
>>>> example script: "C-h f diary-mail-entries".
>>
>>>> But I think this can be handled by the "midnight.el" library, already
>>>> included: "run something every midnight, e.g., kill old buffers".
>>
>> I couldn't get the example script to run but I did get "midnight.el" (which
>> I didn't even know existed) to work.
>>
>> Thank you very much.
>>
>> Arthur
--
Sent from my GNU Emacs running on GNU/Linux
ROSENWALD’S THEOREM: The belief that all the wrong people have self-esteem.
Douglas Coupland: Player One
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: diary-mail-entries
2022-10-16 20:31 ` diary-mail-entries Thorsten Bonow
@ 2022-10-17 11:21 ` aalinovi
0 siblings, 0 replies; 11+ messages in thread
From: aalinovi @ 2022-10-17 11:21 UTC (permalink / raw)
To: Thorsten Bonow; +Cc: help-gnu-emacs
In message <87tu43wlw3.fsf@post.rwth-aachen.de>, Thorsten Bonow writes:
>>>>>> aalinovi <aalinovi@riseup.net> writes:
>
>> My problem is that not only does dairy-mail-entry run at 40 minutes after
>> midnight, it also runs each and everytime I start emacs.
>
>Hi,
>
>There are two ways of setting the delay:
>
>`midnight-delay-set' accepts a number as second arg, specifying the number of
>seconds after the midnight when the midnight-timer is run. So
>(midnight-delay-set 'midnight-delay 2400) would have done the trick.
Thank you. That seems to work. I appreciate you taking the time to help
me with this.
Arthur
^ permalink raw reply [flat|nested] 11+ messages in thread
* diary-mail-entries
@ 2024-07-22 15:40 Arthur Alinovi
2024-07-22 18:33 ` diary-mail-entries Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 11+ messages in thread
From: Arthur Alinovi @ 2024-07-22 15:40 UTC (permalink / raw)
To: help-gnu-emacs
I have the following in ~/.emacs.d/init.el:
(require 'midnight)
(setq midnight-period 39600) ;; (eq (* 11 60 60) "12 hours")
(midnight-delay-set 'midnight-delay 1800)
(add-hook 'midnight-hook 'diary-mail-entries)
My thinking is that this sets "midnight" for 11:00am and runs the
midnight-hook diary-mail-entries 30 minutes later.
Obviously, my thinking is flawed or I wouldn't be here.
So, what am I doing wrong and how do I correct it?
Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: diary-mail-entries
2024-07-22 15:40 diary-mail-entries Arthur Alinovi
@ 2024-07-22 18:33 ` Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 11+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-22 18:33 UTC (permalink / raw)
To: help-gnu-emacs
Arthur Alinovi <aalinovi@riseup.net> writes:
> (setq midnight-period 39600) ;; (eq (* 11 60 60) "12 hours")
I don't think you want to set this variable: AFAIU this is the length of
a day - with other words, the delay between two timer invocations.
> (midnight-delay-set 'midnight-delay 1800)
Calling a setter function of an option will not necessarily set the
variable. You want
(setopt midnight-delay ...)
> (add-hook 'midnight-hook 'diary-mail-entries)
> My thinking is that this sets "midnight" for 11:00am and runs the
> midnight-hook diary-mail-entries 30 minutes later.
This would be (* 11 60 60) for "...".
Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-07-22 18:33 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-22 15:40 diary-mail-entries Arthur Alinovi
2024-07-22 18:33 ` diary-mail-entries Michael Heerdegen via Users list for the GNU Emacs text editor
-- strict thread matches above, loose matches on Subject: below --
2022-10-14 13:42 diary-mail-entries aalinovi
2022-10-16 20:31 ` diary-mail-entries Thorsten Bonow
2022-10-17 11:21 ` diary-mail-entries aalinovi
2022-10-13 16:53 diary-mail-entries aalinovi
2022-10-13 17:31 ` diary-mail-entries Thorsten Bonow
2022-10-13 19:21 ` diary-mail-entries Emanuel Berg
2022-10-13 19:23 ` diary-mail-entries Emanuel Berg
2007-03-20 21:49 diary-mail-entries sven.bretfeld
2007-03-21 4:45 ` diary-mail-entries Kevin Rodgers
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 read-only IMAP folder(s) and NNTP newsgroup(s).