mu4e: use mu4e-attachment-dir for attaching, too

Use mu4e-attachment-dir also for attaching (and not just for extracting)
attachments; the default (current draft message dir) is not very useful.
This commit is contained in:
Dirk-Jan C. Binnema 2020-04-06 20:47:29 +03:00
parent 51f5ee829d
commit edd47ced71
4 changed files with 19 additions and 6 deletions

View File

@ -93,7 +93,10 @@
~plist~ to ~t~. For speed-reasons, these counts do _not_ filter out duplicates ~plist~ to ~t~. For speed-reasons, these counts do _not_ filter out duplicates
or messages that have been removed from the filesystem behind mu4e's back. or messages that have been removed from the filesystem behind mu4e's back.
- The mu4e <-> mu intreaction has been rewritten to communicate using - ~mu4e-attachment-dir~ now also applies to composing messages; it determines
the default directory for inclusion.
- The mu4e <-> mu interaction has been rewritten to communicate using
s-expressions, with a repl for testing. If you have readline installed, s-expressions, with a repl for testing. If you have readline installed,
you also get history. you also get history.

View File

@ -477,6 +477,11 @@ buffers; lets remap its faces so it uses the ones for mu4e."
(visual-line-mode t)) (visual-line-mode t))
(setq mml-enable-flowed nil)) (setq mml-enable-flowed nil))
;; set the attachment dir to something more reasonable than the draft
;; directory.
(setq default-directory (mu4e~get-attachment-dir))
(let ((keymap (lookup-key message-mode-map [menu-bar text]))) (let ((keymap (lookup-key message-mode-map [menu-bar text])))
(when keymap (when keymap
(define-key-after (define-key-after

View File

@ -167,10 +167,15 @@ better with e.g. offlineimap."
:safe 'booleanp) :safe 'booleanp)
(defcustom mu4e-attachment-dir (expand-file-name "~/") (defcustom mu4e-attachment-dir (expand-file-name "~/")
"Default directory for saving attachments. "Default directory for attaching and saving attachments.
This can be either a string (a file system path), or a function This can be either a string (a file system path), or a function
that takes a filename and the mime-type as arguments, and returns that takes a filename and the mime-type as arguments, and returns
the attachment dir. See Info node `(mu4e) Attachments' for details." the attachment dir. See Info node `(mu4e) Attachments' for
details.
When this called for composing a message, both filename and
mime-type are nill."
:type 'directory :type 'directory
:group 'mu4e :group 'mu4e
:safe 'stringp) :safe 'stringp)

View File

@ -1340,9 +1340,9 @@ OS X) the @t{open} program for opening attachments. If you want to use another
program, you do so by setting the @t{MU_PLAY_PROGRAM} environment variable to program, you do so by setting the @t{MU_PLAY_PROGRAM} environment variable to
the program to be used. the program to be used.
The default directory for extracting (saving) attachments is your home The default directory for attaching and extracting (saving)
directory (@file{~/}); you can change this using the variable attachmentsis your home directory (@file{~/}); you can change this
@code{mu4e-attachment-dir}, for example: using the variable @code{mu4e-attachment-dir}, for example:
@lisp @lisp
(setq mu4e-attachment-dir "~/Downloads") (setq mu4e-attachment-dir "~/Downloads")