A.4 Hydra

People sometimes ask about having multi-character shortcuts for bookmarks; an easy way to achieve this, is by using an emacs package Hydra.

With Hydra installed, we can add multi-character shortcuts, for instance:

(defhydra my-mu4e-bookmarks-work (:color blue)
  "work bookmarks"
  ("b" (mu4e-search "banana AND maildir:/work") "banana")
  ("u" (mu4e-search "flag:unread AND maildir:/work")   "unread"))

(defhydra my-mu4e-bookmarks-personal (:color blue)
  "personal bookmarks"
  ("c" (mu4e-search "capybara AND maildir:/personal") "capybara")
  ("u" (mu4e-search "flag:unread AND maildir:/personal")  "unread"))

(defhydra my-mu4e-bookmarks (:color blue)
  "mu4e bookmarks"
  ("p" (my-mu4e-bookmarks-personal/body) "Personal")
  ("w" (my-mu4e-bookmarks-work/body) "Work"))

Now, you can bind a convenient key to my-mu4e-bookmarks/body.