* mu4e-mark: use y-or-n-p, not yes-or-no-p to ask for confirmation

This commit is contained in:
djcb
2012-04-28 13:46:38 +03:00
parent b57f1e3314
commit 99c1042769

View File

@ -143,8 +143,7 @@ provided, function asks for it."
(mu4e-mark-set 'move target)))) (mu4e-mark-set 'move target))))
(defun mu4e-mark-execute-all (&optional no-confirmation)
(defun mu4e-mark-execute-all ()
"Execute the actions for all marked messages in this "Execute the actions for all marked messages in this
buffer. After the actions have been executed succesfully, the buffer. After the actions have been executed succesfully, the
affected messages are *hidden* from the current header list. Since affected messages are *hidden* from the current header list. Since
@ -153,14 +152,17 @@ the messages no longer matches the current one - to get that
certainty, we need to rerun the search, but we don't want to do certainty, we need to rerun the search, but we don't want to do
that automatically, as it may be too slow and/or break the users that automatically, as it may be too slow and/or break the users
flow. Therefore, we hide the message, which in practice seems to flow. Therefore, we hide the message, which in practice seems to
work well." work well.
If NO-CONFIRMATION is non-nil, don't ask user for confirmation."
(interactive) (interactive)
(let ((marknum (hash-table-count mu4e~mark-map))) (let ((marknum (hash-table-count mu4e~mark-map)))
(if (zerop marknum) (if (zerop marknum)
(message "Nothing is marked") (message "Nothing is marked")
(when (yes-or-no-p (when (or no-confirmation
(format "Are you sure you want to execute %d mark%s?" (y-or-n-p
marknum (if (> marknum 1) "s" ""))) (format "Are you sure you want to execute %d mark%s?"
marknum (if (> marknum 1) "s" ""))))
(maphash (maphash
(lambda (docid val) (lambda (docid val)
(let ((mark (nth 0 val)) (target (nth 1 val))) (let ((mark (nth 0 val)) (target (nth 1 val)))
@ -216,6 +218,6 @@ action', return nil means 'don't do anything'"
("ignore marks?" nil ignore))))) ("ignore marks?" nil ignore)))))
;; we determined what to do... now do it ;; we determined what to do... now do it
(when (eq what 'apply) (when (eq what 'apply)
(mu4e-mark-execute-all)))))))) (mu4e-mark-execute-all t))))))))
(provide 'mu4e-mark) (provide 'mu4e-mark)