help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alarm clock for emacs


From: B. T. Raven
Subject: Re: Alarm clock for emacs
Date: Tue, 27 Jun 2006 19:29:56 -0500

"Mathias Dahl" <brakjoller@gmail.com> wrote in message
uzmfzgdo9.fsf@gmail.com">news:uzmfzgdo9.fsf@gmail.com...
> Leon <sdl.web@gmail.com> writes:
>
> > Does anyone know of an alarm clock that runs in emacs?
>
> There is now! :) See below:
>
> (defvar alarm-clock-timer nil
>   "Keep timer so that the user can cancel the alarm")
>
> (defun alarm-clock-message (text)
>   "The actual alarm action"
>   (message-box text))
>
> (defun alarm-clock ()
>   "Set an alarm.
> The time format is the same accepted by `run-at-time'.  For
> example \"11:30am\"."
>   (interactive)
>   (let ((time (read-string "Time: "))
>         (text (read-string "Alarm message: ")))
>     (setq alarm-clock-timer (run-at-time time nil 'alarm-clock-message
text))))
>
> (defun alarm-clock-cancel ()
>   "Cancel the alarm clock"
>   (interactive)
>   (cancel-timer alarm-clock-timer))
>
> It is very simple. It does not, for example, keep track of multiple
> alarms so that you can cancel them individually.
>
> /Mathias

You can also add (ding) or (beep) before the (message-box text) but
apparenty not repeated beeps. Does anyone know of some way of doing this
(... while some-condition obtains [the message-box not closed] issue
repeated sounds). In 22.0 there is play-sound and play-sound-file but not
in 21.3.

Thanks,

Ed.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]