0

Reference to 31.10.6 Appointments of Emacs Manual

It provides a handy solution to report hour and remind appointments:

For example, suppose the diary file contains these lines:
=M-x appt-add= adds entries to the appointment list without affecting your diary file. You delete entries from the appointment list with =M-x appt-delete=.

Then if set the minutes to warning as 0 minutes to remind whole hours, it becomes a alarm to report whole hour to prompt a mini-buffer.

For example, M-x appt-add a whole hour "9:00pm" and set the warning as 0 minute. When it comes to 9:00pm, a mini-buffer would be prompt to report the current time.
At this moment, appointment transforms itself as an alarm to report whole hours.

Unfortunately, the appointment is one-off and it's cumbersome to set alarms manually every day.

How could have an alarm to report whole hours using appointments or any alternative solutions?

  • So is your question: "How do I set an alarm in emacs?" Or is it: "How do I get emacs to make an announcement every hour on the hour?" – NickD Mar 10 at 18:39
  • @NickD "How do I get emacs to make an announcement every hour on hour? – Calculus Mar 10 at 21:38
  • Have you looked at timers? – NickD Mar 10 at 22:15
1

You can do that using timers. Define a function to print out the time in the echo area:

(defun announce-time ()
  (message (format "The time is %s" (format-time-string "%H:%M" (current-time)))))

and set up a timer to run it at some initial time and every hour thereafter:

(run-at-time "00:00" 3600 #'announce-time)

You can cancel the timer if you don't want it any longer with M-x list-timers RET and pressing c on this timer.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.