fix(mu4e): file attachment prompt arguments

There are two changes to the default optional read-file-name arguments
that should be made for the purpose of attaching files:
1. The optional MUSTMATCH argument should be set, as one can't exactly
   attach non-existent files.
2. The INITIAL argument should be set to the empty string so that if
   default-directory is customised for some reason or another that
   selecting it leads to the expected directory being selected.
   Without INITIAL or DEFAULT-FILENAME being specified, the current file
   path will be used, which is never desirable as this is simply a path
   to the message buffer.
This commit is contained in:
TEC 2022-09-24 20:08:17 +08:00 committed by Henrik Lissner
parent f1e793405d
commit 30a4eb7f77

View file

@ -270,7 +270,7 @@ When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-
(pcase major-mode (pcase major-mode
((or 'mu4e-compose-mode 'org-msg-edit-mode) ((or 'mu4e-compose-mode 'org-msg-edit-mode)
(let ((mail-buffer (current-buffer)) (let ((mail-buffer (current-buffer))
(location (read-file-name "Attach: "))) (location (read-file-name "Attach: " nil nil t "")))
(if (not (file-directory-p location)) (if (not (file-directory-p location))
(pcase major-mode (pcase major-mode
('mu4e-compose-mode ('mu4e-compose-mode