July 17, 2019
emacs

Use unicode symbol to display org-mode checkboxes

With the help of prettify-symbols-mode, you can make your Emacs displaying org-mode checkboxes as a real Unicode symbols, instead of a boring text, put this to your org-mode-hook:

(add-hook 'org-mode-hook (lambda ()
  "Beautify Org Checkbox Symbol"
  (push '("[ ]" .  "☐") prettify-symbols-alist)
  (push '("[X]" . "☑" ) prettify-symbols-alist)
  (push '("[-]" . "❍" ) prettify-symbols-alist)
  (prettify-symbols-mode)))

You can also use font-lock-add-keywords to add a different style for checked boxes, like what I did below, adding a strike-through style:

(defface org-checkbox-done-text
  '((t (:foreground "#71696A" :strike-through t)))
  "Face for the text part of a checked org-mode checkbox.")

(font-lock-add-keywords
 'org-mode
 `(("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)"
    1 'org-checkbox-done-text prepend))
 'append)

Here’s the result:

@this-is-a-tag
Waiting
* Work in progress
Done
Flagged
Hey! Have you tried Pomoday?
It's a keyboard-oriented, very easy to use and very powerful web-based task management software.
Powered by a lot of ☕