mirror of https://github.com/djcb/mu.git
mu4e: use mu4e-determine-attachment-dir
Make the old internal mu4e~get-attachment-dir a public function, improve documentation. Update callers.
This commit is contained in:
parent
66e113ef2a
commit
3b93863f15
|
@ -359,7 +359,7 @@ buffers; lets remap its faces so it uses the ones for mu4e."
|
|||
|
||||
;; set the attachment dir to something more reasonable than the draft
|
||||
;; directory.
|
||||
(setq default-directory (mu4e~get-attachment-dir))
|
||||
(setq default-directory (mu4e-determine-attachment-dir))
|
||||
|
||||
(let ((keymap (lookup-key message-mode-map [menu-bar text])))
|
||||
(when keymap
|
||||
|
|
|
@ -154,7 +154,7 @@ the attachment dir. See Info node `(mu4e) Attachments' for
|
|||
details.
|
||||
|
||||
When this called for composing a message, both filename and
|
||||
mime-type are nill."
|
||||
mime-type are nil."
|
||||
:type 'directory
|
||||
:group 'mu4e-folders
|
||||
:safe 'stringp)
|
||||
|
@ -330,9 +330,14 @@ Offer to create it if it does not exist yet."
|
|||
;; filename and the mime-type as argument, either (or both) which can
|
||||
;; be nil
|
||||
|
||||
(defun mu4e~get-attachment-dir (&optional fname mimetype)
|
||||
"Get the directory for saving attachments from `mu4e-attachment-dir'.
|
||||
This is optionally based on the file-name FNAME and its MIMETYPE."
|
||||
(defun mu4e-determine-attachment-dir (&optional fname mimetype)
|
||||
"Get the target-directory for attachments.
|
||||
|
||||
This is based on the variable `mu4e-attachment-dir', which is either:
|
||||
- if is a string, used it as-is
|
||||
- a function taking two string parameters, both of which can be nil:
|
||||
(1) a filename or a URL
|
||||
(2) a mime-type (such as \"text/plain\"."
|
||||
(let ((dir
|
||||
(cond
|
||||
((stringp mu4e-attachment-dir)
|
||||
|
@ -340,7 +345,7 @@ This is optionally based on the file-name FNAME and its MIMETYPE."
|
|||
((functionp mu4e-attachment-dir)
|
||||
(funcall mu4e-attachment-dir fname mimetype))
|
||||
(t
|
||||
(mu4e-error "Unsupported type for mu4e-attachment-dir" )))))
|
||||
(mu4e-error "Unsupported type for mu4e-attachment-dir" )))))
|
||||
(if dir
|
||||
(expand-file-name dir)
|
||||
(mu4e-error "Mu4e-attachment-dir evaluates to nil"))))
|
||||
|
|
|
@ -73,8 +73,8 @@ might want to add soemthing like the following in your configuration.
|
|||
If nil, use the value of `mu4e-completing-read-function', integrated
|
||||
into mu4e.
|
||||
|
||||
Many of the third-party completion frameworks such as Helm, Ivy
|
||||
and Vertico influence `completion-read', so to have mu4e follow
|
||||
Many of the third-party completion frameworks - such as Helm, Ivy
|
||||
and Vertico - influence `completion-read', so to have mu4e follow
|
||||
your overall settings, try the equivalent of
|
||||
|
||||
(setq mu4e-read-option-use-builtin nil
|
||||
|
@ -85,7 +85,6 @@ Emacs `completing-read' is rather Spartan."
|
|||
:type 'boolean
|
||||
:group 'mu4e)
|
||||
|
||||
|
||||
(defcustom mu4e-use-fancy-chars nil
|
||||
"When set, allow fancy (Unicode) characters for marks/threads.
|
||||
You can customize the exact fancy characters used with
|
||||
|
@ -121,7 +120,8 @@ marked as read-only, or non-nil otherwise."
|
|||
(mu4e-get-headers-buffer))
|
||||
((mu4e-current-buffer-type-p 'headers)
|
||||
(mu4e-get-view-buffer))
|
||||
(t (mu4e-error "This window is neither the headers nor the view window."))))
|
||||
(t (mu4e-error
|
||||
"This window is neither the headers nor the view window."))))
|
||||
(other-win (and other-buf (get-buffer-window other-buf))))
|
||||
(if (window-live-p other-win)
|
||||
(select-window other-win)
|
||||
|
@ -206,7 +206,7 @@ Return the cdr (value) of the matching cell, if any."
|
|||
"Read and return one of CHOICES, prompting for PROMPT.
|
||||
|
||||
PROMPT describes a multiple-choice question to the user. CHOICES
|
||||
is an alist of the fiorm
|
||||
is an alist of the form
|
||||
( ( <display-string> ( <shortcut> . <value> ))
|
||||
... )
|
||||
Any input that is not one of CHOICES is ignored. This is mu4e's
|
||||
|
@ -227,7 +227,8 @@ Return the matching choice value (cdr of the cell)."
|
|||
(let ((prefix (minibuffer-contents-no-properties)))
|
||||
(unless (string-empty-p prefix)
|
||||
(setq quick-result
|
||||
(mu4e--matching-choice choices (string-to-char prefix)))
|
||||
(mu4e--matching-choice
|
||||
choices (string-to-char prefix)))
|
||||
(when quick-result
|
||||
(exit-minibuffer)))))
|
||||
-1 'local))
|
||||
|
@ -474,7 +475,6 @@ If there is not e-mail address at point, do nothing."
|
|||
(format "%d" size))
|
||||
(t "?")))
|
||||
|
||||
|
||||
(defun mu4e-split-ranges-to-numbers (str n)
|
||||
"Convert STR containing attachment numbers into a list of numbers.
|
||||
|
||||
|
@ -542,7 +542,8 @@ Or go to the top level if there is none."
|
|||
(date (if date (format-time-string "%F: " date) ""))
|
||||
(title (format "%s%s" date subject))
|
||||
(msgid (or (plist-get msg :message-id)
|
||||
(mu4e-error "Cannot bookmark message without message-id"))))
|
||||
(mu4e-error
|
||||
"Cannot bookmark message without message-id"))))
|
||||
`(,title
|
||||
,@(bookmark-make-record-default 'no-file 'no-context)
|
||||
(message-id . ,msgid)
|
||||
|
|
Loading…
Reference in New Issue