mirror of https://github.com/djcb/mu.git
* mu4e: offer to create target dirs when they do not exist yet
This commit is contained in:
parent
a7f974d207
commit
23fc0b4a63
|
@ -237,6 +237,8 @@ replace them with a _real_ mark (ask the user which one)."
|
|||
(mu4e-mark-set (car markpair) (cdr markpair)))))))
|
||||
mu4e~mark-map)))
|
||||
|
||||
|
||||
|
||||
(defun mu4e-mark-execute-all (&optional no-confirmation)
|
||||
"Execute the actions for all marked messages in this
|
||||
buffer. After the actions have been executed succesfully, the
|
||||
|
@ -260,7 +262,11 @@ If NO-CONFIRMATION is non-nil, don't ask user for confirmation."
|
|||
marknum (if (> marknum 1) "s" ""))))
|
||||
(maphash
|
||||
(lambda (docid val)
|
||||
(let ((mark (car val)) (target (cdr val)))
|
||||
(let* ((mark (car val)) (target (cdr val))
|
||||
(fulltarget (concat mu4e-maildir target)))
|
||||
;; check if the target exists; if not, offer to create it
|
||||
(unless (mu4e-create-maildir-maybe fulltarget)
|
||||
(mu4e-error "Target dir %s does not exist" fulltarget))
|
||||
;; note: whenever you do something with the message,
|
||||
;; it looses its N (new) flag
|
||||
(case mark
|
||||
|
|
|
@ -361,6 +361,8 @@ or (:error ) sexp, which are handled my `mu4e-update-func' and
|
|||
`mu4e-error-func', respectively."
|
||||
(unless (or maildir flags)
|
||||
(mu4e-error "At least one of maildir and flags must be specified"))
|
||||
(unless (or (not maildir) (file-exists-p (concat mu4e-maildir "/" maildir "/")))
|
||||
(mu4e-error "Target dir does not exist"))
|
||||
(let* ((idparam (mu4e--docid-msgid-param docid-or-msgid))
|
||||
(flagstr
|
||||
(when flags
|
||||
|
|
|
@ -127,8 +127,9 @@ see its docstring)."
|
|||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defun mu4e-create-maildir-maybe (dir)
|
||||
"Offer to create DIR if it does not exist yet. Return t if the
|
||||
dir already existed, or has been created, nil otherwise."
|
||||
"Offer to create maildir DIR (full filesystem path) if it does
|
||||
not exist yet. Return t if the dir already existed, or has been
|
||||
created, nil otherwise."
|
||||
(if (and (file-exists-p dir) (not (file-directory-p dir)))
|
||||
(mu4e-error "%s exists, but is not a directory." dir))
|
||||
(cond
|
||||
|
|
Loading…
Reference in New Issue