branch: elpa/helm commit a9231089b29aac8ab1d74aceba0ea15e934d5b23 Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Change behavior of PROMPT-FORMATER argument in helm-read-answer-dolist-with-action. Use it in HFF quick delete. --- helm-files.el | 6 ++---- helm-lib.el | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/helm-files.el b/helm-files.el index 17e1e8aa4d..6d4c1cd239 100644 --- a/helm-files.el +++ b/helm-files.el @@ -6112,9 +6112,7 @@ When a prefix arg is given, meaning of (and trash (helm-ff-trash-list (helm-trash-directory))))) (unwind-protect (helm-read-answer-dolist-with-action - (concat (format "Really %s file" - (if trash "Trash" "Delete")) - " `%s'") + "Really %s file `%s'" marked (lambda (c) (helm-preselect @@ -6135,7 +6133,7 @@ When a prefix arg is given, meaning of (t (helm-delete-current-selection))) (message nil) (helm--remove-marked-and-update-mode-line c)) - #'abbreviate-file-name) + (list (if trash "Trash" "Delete") #'abbreviate-file-name)) (setq helm-marked-candidates nil helm-visible-mark-overlays nil) (helm-force-update diff --git a/helm-lib.el b/helm-lib.el index c8fbe9d21c..142d68886d 100644 --- a/helm-lib.el +++ b/helm-lib.el @@ -1354,18 +1354,27 @@ differently depending of answer: - ! Don't ask anymore and execute ACTION on remaining elements. - q Skip all remaining elements. -PROMPT-FORMATER is a function called with one argument which is -used to modify each element of LIST to be displayed in PROMPT." +PROMPT-FORMATER may be a function or a list containing strings and +functions. Functions either in list or alone are called on each element +in LIST to be displayed in PROMPT." (let (dont-ask) (catch 'break (dolist (elm list) (if dont-ask (funcall action elm) (helm-acase (helm-read-answer - (format (concat prompt "[y,n,!,q,h]") - (if prompt-formater - (funcall prompt-formater elm) - elm)) + (apply #'format + (concat prompt "[y,n,!,q,h]") + (helm-acase prompt-formater + ((guard (listp it)) + (mapcar (lambda (x) + (if (functionp x) + (funcall x elm) + x)) + it)) + ((guard (functionp it)) + (list (funcall it elm))) + (t it))) '("y" "n" "!" "q") (or help-function #'helm-read-answer-default-help-fn)) ("y" (funcall action elm))