summaryrefslogtreecommitdiff
path: root/lisp/epa.el
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@unixuser.org>2011-08-12 12:30:18 +0900
committerDaiki Ueno <ueno@unixuser.org>2011-08-12 12:30:18 +0900
commit9d5cb6312b5e6ad61c7cdb5a1282d81e677899f2 (patch)
tree04514188a88ba9bb498f81e061f3e10738c8fcd6 /lisp/epa.el
parentfb568e63275f2dc92de1eb506a6f12838757b2bd (diff)
downloademacs-9d5cb6312b5e6ad61c7cdb5a1282d81e677899f2.tar.gz
Make epa-file progress message user-friendly.
* epa.el (epa-progress-callback-function): Fix the logic of displaying progress. * epa-file.el (epa-file-insert-file-contents): Make progress display more user-friendly. (epa-file-write-region): Ditto.
Diffstat (limited to 'lisp/epa.el')
-rw-r--r--lisp/epa.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/epa.el b/lisp/epa.el
index d4f4fab2eed..e2fafc753d7 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -651,10 +651,17 @@ If SECRET is non-nil, list secret keys instead of public keys."
(defun epa-progress-callback-function (_context what _char current total
handback)
- (message "%s%d%% (%d/%d)" (or handback
- (concat what ": "))
- (if (> total 0) (floor (* (/ current (float total)) 100)) 0)
- current total))
+ (let ((prompt (or handback
+ (format "Processing %s: " what))))
+ ;; According to gnupg/doc/DETAIL: a "total" of 0 indicates that
+ ;; the total amount is not known. The condition TOTAL && CUR ==
+ ;; TOTAL may be used to detect the end of an operation.
+ (if (> total 0)
+ (if (= current total)
+ (message "%s...done" prompt)
+ (message "%s...%d%%" prompt
+ (floor (* (/ current (float total)) 100))))
+ (message "%s..." prompt))))
;;;###autoload
(defun epa-decrypt-file (file)