As a programmer who sits before a computer more than 8 hours a day(yeah really more than 8 …), standing up and exercising a bit regularly is said to be a good way to extend my lifespan.
Given that I keep the emacs process live as long as my computer is on, I decide to set some alarms in emacs so it reminds to stand up and do some stretches every hour.
First step, install appt in emacs:
M-x el-get-install appt (or through any other emacs plugins installation approach). However, it turns out that appt requires some functions that are not available in emacs 24.4. Therefore, I have to do some small modifications to appt.
Remove the elc in case it affects anything:
M-x delete-file ~/.emacs.d/el-get/appt/appt.elc. Then open the
appt.el, C-x C-f ~/.emacs.d/el-get/appt/appt.el, search for update-calendar-mode-line and delete every line that contains it.
C-x C-s, save the file. Now appt is usable.
Evaluate the following s-expressions and put them in your init.el:
Since I just want to stand up and do some stretches regularly, I set appt-message-warning-time to 0, otherwise warnings would pop up a few minutes in advance.
Then specify a diary file:
~/diary (you can set it to any file you like)
Create this diary file
C-x C-f ~/diary and write the following content to it (there might be more concise ways to express what I wrote, I didn’t read through the document):
Save this file and press
M-x appt-activate, done, emacs will pop up a new buffer for each entry in the diary on time.