Previous: , Up: Interaction with other tools   [Contents]

A.8 Dired

It is possible to attach files to mu4e messages using dired (See (emacs)Dired), using the following steps (based on a post on the mu-discuss mailing list by Stephen Eglen).

To prepare for this, you need a special version of the gnus-dired-mail-buffers function so it understands mu4e buffers as well; so put in your configuration:

(require 'gnus-dired)
;; make the `gnus-dired-mail-buffers' function also work on
;; message-mode derived modes, such as mu4e-compose-mode
(defun gnus-dired-mail-buffers ()
  "Return a list of active message buffers."
  (let (buffers)
      (dolist (buffer (buffer-list t))
        (set-buffer buffer)
        (when (and (derived-mode-p 'message-mode)
                (null message-sent-message-via))
          (push (buffer-name buffer) buffers))))
    (nreverse buffers)))

(setq gnus-dired-mail-mode 'mu4e-user-agent)
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)

Then, mark the file(s) in dired you would like to attach and press C-c RET C-a, and you’ll be asked whether to attach them to an existing message, or create a new one.