Some useful mu4e shortcuts

I wrote recently about setting up a custom key map, and there are a couple of shortcuts for mu4e functions that I use very often with that key map.

With the following code I define c in my key map to compose a new email. Since I previously set C-1 to be the prefix for my map, then C-1 c is the full keybinding. This works globally so I can start a new email from anywhere in Emacs with C-1 c.

I then supercharge the keybinding by using it to add a CC to an email if I am already composing one. This is done by binding C-1 c in the mu4e-compose-mode-map to message-goto-cc. So now C-1 c starts a new email unless I am already writing an email in which case it adds a CC instead.

While I am at it, I also add s to my keymap for mu4e-headers-search so I can use C-1 s to launch a search of my emails from anywhere in Emacs.

;; bjm-map is already  bound to the prefix C-1
;; use C-1 c to compose a new email
(define-key bjm-map (kbd "c") 'mu4e-compose-new)
;; use C-1 c for add cc if already in composition mode
(define-key mu4e-compose-mode-map (kbd "C-1 c") 'message-goto-cc)
;; add search
(define-key bjm-map (kbd "s") 'mu4e-headers-search)
  • Thanks for the post. I use C-x m for mu4e-compose-new since it’s compose-mail in Emacs by default.

    I’ve also set up M-s as a search prefix key. It feels really natural to me to have C-s for isearch then M-s for all sorts of other searches. M-s M-w is eww-search-words by default, then I added M-s m to search mail, M-s p to search passwords, M-s x to search stackexchange, and M-s q to search wolfram alpha.

    • Good idea to use M-s as a prefix key. I use M-s for avy but I could use M-s a and then have other searches as you suggest. Thanks!

  • Pingback: 2017-02-27 Emacs News –()