[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm 5c5fb8d5d3 08/14: Make helm-ff-compress-marked-files
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm 5c5fb8d5d3 08/14: Make helm-ff-compress-marked-files async as well |
Date: |
Fri, 15 Mar 2024 04:00:28 -0400 (EDT) |
branch: elpa/helm
commit 5c5fb8d5d3b0857f7a4eda26292887242502751b
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Make helm-ff-compress-marked-files async as well
---
helm-files.el | 45 ++++++++++++++++++++++++++++++++-------------
1 file changed, 32 insertions(+), 13 deletions(-)
diff --git a/helm-files.el b/helm-files.el
index 31eb17f2f6..c6fa50de20 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -1525,24 +1525,36 @@ This reproduce the behavior of \"cp --backup=numbered
from to\"."
(defun helm-ff-compress-marked-files (_candidate)
"Compress or uncompress marked files with `dired-compress-file'."
- (let* ((files (helm-marked-candidates :with-wildcard t))
- (len 0))
+ (let* ((files (helm-marked-candidates :with-wildcard t)))
(if (not (with-helm-display-marked-candidates
helm-marked-buffer-name
(mapcar #'abbreviate-file-name files)
(y-or-n-p (format "Compress or uncompress *%s File(s)" (length
files)))))
(message "(No (un)compression performed)")
- (cl-dolist (i files)
- (when (helm-ff--dired-compress-file i)
- (cl-incf len)))
- (message "%s File(s) (un)compressed" len))))
-
-(defun helm-ff--dired-compress-file (file)
- ;; `dired-compress-file' doesn't take care of binding `default-directory'
when
- ;; uncompressing FILE, as a result FILE is uncompressed in the directory
where
- ;; helm was started i.e. the current value of `default-directory'.
- (with-helm-default-directory helm-ff-default-directory
- (dired-compress-file file)))
+ (process-put
+ (async-start
+ `(lambda ()
+ (require 'dired-aux)
+ (let ((len 0))
+ (dolist (i ',files)
+ (let ((default-directory (file-name-directory i)))
+ (when (dired-compress-file i)
+ (cl-incf len))))
+ len))
+ `(lambda (result)
+ (helm-ff--compress-async-modeline-mode -1)
+ (message "%s File(s) (un)compressed" result)
+ (run-with-timer
+ 0.1 nil
+ (lambda (num-files)
+ (dired-async-mode-line-message
+ "%s %d/%d file(s) done"
+ 'helm-delete-async-message
+ "Compressing"
+ num-files (length ',files)))
+ result)))
+ 'helm-async-compress t)
+ (helm-ff--compress-async-modeline-mode 1))))
(defun helm-ff-chmod (_candidate)
"Set file mode on marked files.
@@ -5948,6 +5960,13 @@ and `dired-compress-files-alist'."
do (setq base (fill-common-string-prefix base file))
finally return (file-name-directory base)))
+(defun helm-ff--dired-compress-file (file)
+ ;; `dired-compress-file' doesn't take care of binding `default-directory'
when
+ ;; uncompressing FILE, as a result FILE is uncompressed in the directory
where
+ ;; helm was started i.e. the current value of `default-directory'.
+ (with-helm-default-directory helm-ff-default-directory
+ (dired-compress-file file)))
+
(defun helm-ff-quick-compress (_candidate)
"Compress or uncompress file CANDIDATE without quitting."
(with-helm-window
- [nongnu] elpa/helm 03366cebc3 06/14: Fix uncompressing from persistent action and action, (continued)
- [nongnu] elpa/helm 03366cebc3 06/14: Fix uncompressing from persistent action and action, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 0d52f2d7bb 04/14: base-dir is modified, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 2c0436ff9e 05/14: Start making async compress actions, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 9cb7f35e9f 14/14: Notify compress keybindings in actions, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 392505b965 13/14: Remove comment (now fixed), ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 1573d28140 10/14: Fix mode-line message, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 167bccd65a 07/14: Prefer save-selected-window, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 753c2f46cc 01/14: compress files to archive from helm-ff, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 8e2aa5ba3f 09/14: Add compress marked file command from action, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm bbc6b36801 03/14: persistent compress/uncompress files from helm-ff, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 5c5fb8d5d3 08/14: Make helm-ff-compress-marked-files async as well,
ELPA Syncer <=
- [nongnu] elpa/helm 5652bf0fe7 11/14: Provide keybindings for compress commands, ELPA Syncer, 2024/03/15
- [nongnu] elpa/helm 8ebd1761d1 12/14: Use temporary-file-directory to setup error-file, ELPA Syncer, 2024/03/15