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:

;; Diary entries notification
(require 'appt)
(setq appt-message-warning-time 0)      ; 0 minute time before warning
(setq diary-file "~/diary")             ; diary file

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):

Sunday
  9:00am stand up
  10:00am stand up
  11:00am stand up
  12:00pm lunch time
  2:00pm stand up
  3:00pm stand up
  4:00pm stand up
  5:00pm break, go for a walk

  etc ... 

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.


Reference:

  1. Delete the file corresponding to the current buffer
  2. Split into multiple windows vertically
  3. Insert source code block in org-mode
  4. Edit current file as root
  5. Getting rid of mouse