UP | HOME

Use Emacs as a reminder

Emacs has a built-in diary-mode which is really awesome. I mostly use it as a reminder.

To start using it, you need to create a ~/diary or ~/.emacs.d/diary file, open it. Jot down everything you need, like this:

diary-appointment.png

By default, a notification text will be displayed on your mode-line just about 10 minutes before the event.

If you want to setup a desktop notification, use the following snippet:

;; Appointment Setup
(require 'appt)
(setq appt-time-msg-list nil
      appt-display-interval '3
      appt-message-warning-time '12
      appt-display-mode-line t
      appt-display-format 'window)
(appt-activate 1)

(defvar terminal-notifier-path
  "/usr/local/bin/terminal-notifier")

(defun user-appt-send-notification (title msg)
  (shell-command (concat terminal-notifier-path
                         " -message " msg
                         " -title " title
                         " -appIcon /Applications/Calendar.app/Contents/Resources/App-empty.icns")))

(defun user-appt-display (min-to-app new-time msg)
  (user-appt-send-notification
   (format "'🔥 Appointment in %s minutes'" min-to-app)
   (format "'%s'" msg)))

(setq appt-disp-window-function (function user-appt-display))

The appt-message-warning-time is the amount of time before the event we'll first display a notification. Then, we'll repeat the notification every appt-display-interval minutes from the appt-message-warning-time.

To display the notification, we'll use terminal-notifier, if you don't have it yet, install with:

brew install terminal-notifier

The user-appt-send-notification function construct and call the terminal-notifier command, in here, we supply the appIcon parameter, points to an icon from macOS's Calendar application.

Somebody also use org-agenda-to-appt function to create appointment entry from org-agenda, this might be helpful, but I don't find it fitting my workflow, so I'll just leave it.

Date: 2019-01-21 Mon 00:00

Author: Huy Tran

Created: 2019-04-22 Mon 14:41