aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaiki Ueno2011-08-12 12:30:18 +0900
committerDaiki Ueno2011-08-12 12:30:18 +0900
commit9d5cb6312b5e6ad61c7cdb5a1282d81e677899f2 (patch)
tree04514188a88ba9bb498f81e061f3e10738c8fcd6
parentfb568e63275f2dc92de1eb506a6f12838757b2bd (diff)
downloademacs-9d5cb6312b5e6ad61c7cdb5a1282d81e677899f2.tar.gz
emacs-9d5cb6312b5e6ad61c7cdb5a1282d81e677899f2.zip
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.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/epa-file.el12
-rw-r--r--lisp/epa.el15
3 files changed, 27 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ad300b10f47..27515f767fb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-08-12 Daiki Ueno <ueno@unixuser.org>
2
3 * epa.el (epa-progress-callback-function): Fix the logic of
4 displaying progress.
5 * epa-file.el (epa-file-insert-file-contents): Make progress
6 display more user-friendly.
7 (epa-file-write-region): Ditto.
8
12011-08-10 Chong Yidong <cyd@stupidchicken.com> 92011-08-10 Chong Yidong <cyd@stupidchicken.com>
2 10
3 * subr.el (string-mark-left-to-right): New function. 11 * subr.el (string-mark-left-to-right): New function.
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index aa9915d8cfa..118f44854cf 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -137,8 +137,10 @@ encryption is used."
137 context 137 context
138 (cons #'epa-file-passphrase-callback-function 138 (cons #'epa-file-passphrase-callback-function
139 local-file)) 139 local-file))
140 (epg-context-set-progress-callback context 140 (epg-context-set-progress-callback
141 #'epa-progress-callback-function) 141 context
142 (cons #'epa-progress-callback-function
143 (format "Decrypting %s" file)))
142 (unwind-protect 144 (unwind-protect
143 (progn 145 (progn
144 (if replace 146 (if replace
@@ -211,8 +213,10 @@ encryption is used."
211 context 213 context
212 (cons #'epa-file-passphrase-callback-function 214 (cons #'epa-file-passphrase-callback-function
213 file)) 215 file))
214 (epg-context-set-progress-callback context 216 (epg-context-set-progress-callback
215 #'epa-progress-callback-function) 217 context
218 (cons #'epa-progress-callback-function
219 (format "Encrypting %s" file)))
216 (epg-context-set-armor context epa-armor) 220 (epg-context-set-armor context epa-armor)
217 (condition-case error 221 (condition-case error
218 (setq string 222 (setq string
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."
651 651
652(defun epa-progress-callback-function (_context what _char current total 652(defun epa-progress-callback-function (_context what _char current total
653 handback) 653 handback)
654 (message "%s%d%% (%d/%d)" (or handback 654 (let ((prompt (or handback
655 (concat what ": ")) 655 (format "Processing %s: " what))))
656 (if (> total 0) (floor (* (/ current (float total)) 100)) 0) 656 ;; According to gnupg/doc/DETAIL: a "total" of 0 indicates that
657 current total)) 657 ;; the total amount is not known. The condition TOTAL && CUR ==
658 ;; TOTAL may be used to detect the end of an operation.
659 (if (> total 0)
660 (if (= current total)
661 (message "%s...done" prompt)
662 (message "%s...%d%%" prompt
663 (floor (* (/ current (float total)) 100))))
664 (message "%s..." prompt))))
658 665
659;;;###autoload 666;;;###autoload
660(defun epa-decrypt-file (file) 667(defun epa-decrypt-file (file)