reddit / emacs

Help needed with midnight-mode

slaurel492 · 2022-10-15 12:58
After a bit of experimenting I finally got diary-mail-entries to actually mail me diary entries. My problem now is with midnight-mode. I copied what I found in the EmacsWiki into my init file, changing calendar to diary-mail-entries: (require 'midnight) (midnight-delay-set 'midnight-delay "4:30am") (add-hook 'midnight-hook 'diary-mail-entries) My problem is, not only do I get email at 4:30am but each and every time I start emacs. If anyone knows what I may be doing wrong or how to correct this I would appreciate it. Thank you
eli-zaretskii · 2022-10-16 19:19
Instead of "4:30" use the number 16200, which is the number of seconds between midnight and 4:30am. Then I think you will get what you want. The problem with "4:30am" tells `midnight` to run the hook at 4:30am *today*, even if that time has passed already. So you get it run at startup.
slaurel492 · 2022-10-17 11:26
Thank you, Eli. I appreciate you taking the time to help. Seems to be working as it should.