branch: elpa/helm commit 320a22e33d76fe4d86b0f4dba38b296393d7d9f2 Merge: e93335b0b9 f38a6f3c2e Author: Thierry Volpiatto <thie...@posteo.net> Commit: GitHub <nore...@github.com>
Merge pull request #2645 from kkatsuyuki/where-to-compress Where to compress input files to --- helm-files.el | 62 ++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/helm-files.el b/helm-files.el index 97472e20c5..46c7d01a4e 100644 --- a/helm-files.el +++ b/helm-files.el @@ -1239,30 +1239,44 @@ ACTION can be `rsync' or any action supported by `helm-dired-action'." (helm-actions-inherit-frame-settings t) helm-use-frame-when-more-than-two-windows (dest (or target - (with-helm-display-marked-candidates - helm-marked-buffer-name - (if (eq action 'compress) - (mapcar - (lambda (f) - (file-relative-name f (helm-common-dir ifiles))) - ifiles) - (helm-ff--count-and-collect-dups ifiles)) - (with-helm-current-buffer - (helm-read-file-name - prompt - :preselect (when cand - (format helm-ff-last-expanded-candidate-regexp - (regexp-quote - (if helm-ff-transformer-show-only-basename - (helm-basename cand) cand)))) - :initial-input (helm-dwim-target-directory) - :default (when (eq action 'compress) - (expand-file-name - (format "%s.tar.gz" (if cand - (helm-basename cand) - "new_archive")) - helm-ff-default-directory)) - :history (helm-find-files-history nil :comp-read nil)))))) + (if (eq action 'compress) + (let ((cdir (helm-common-dir ifiles))) + (with-helm-display-marked-candidates + helm-marked-buffer-name + (mapcar + (lambda (f) + (file-relative-name f cdir)) + ifiles) + (with-helm-current-buffer + (helm-read-file-name + prompt + :preselect + (when cand + (format helm-ff-last-expanded-candidate-regexp + (regexp-quote + (if helm-ff-transformer-show-only-basename + (helm-basename cand) cand)))) + :initial-input cdir + :default (expand-file-name + (format "%s.tar.gz" (if cand + (helm-basename cand) + "new_archive")) + cdir) + :history (helm-find-files-history nil :comp-read nil))))) + (with-helm-display-marked-candidates + helm-marked-buffer-name + (helm-ff--count-and-collect-dups ifiles) + (with-helm-current-buffer + (helm-read-file-name + prompt + :preselect + (when cand + (format helm-ff-last-expanded-candidate-regexp + (regexp-quote + (if helm-ff-transformer-show-only-basename + (helm-basename cand) cand)))) + :initial-input (helm-dwim-target-directory) + :history (helm-find-files-history nil :comp-read nil))))))) (dest-dir-p (file-directory-p dest)) (dest-dir (if dest-dir-p dest (helm-basedir dest)))) ;; We still need to handle directory creation for Emacs version < 27.1 that