Month: February 2017

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)

Batch-edit file permissions in dired

I’ve written before about using the editing features in dired (AKA wdired) to do neat things like redirect symlinks. I recently discovered that by adding the following option to your emacs config file:

;; allow editing file permissions
(setq wdired-allow-to-change-permissions t)

then you can also edit the file permissions directly in the dired buffer.

Here’s a quick animated example where I want to set group write permissions for all the pdf files in a particular directory. I use several tools to make this really easy:

  1. I used dired-narrow to filter the view down to just the pdf files
  2. I use C-x C-q to make the dired buffer editable
  3. I move to the group write permission spot on the first line and then use multiple cursors to add a cursor for each line
  4. I hit w to set the write permission, RET to quit multiple cursors, and C-c C-c to make the change permanent