Commit 9d5cb631 authored by Daiki Ueno's avatar Daiki Ueno
Browse files

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.
parent fb568e63
2011-08-12 Daiki Ueno <ueno@unixuser.org>
* 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.
2011-08-10 Chong Yidong <cyd@stupidchicken.com> 2011-08-10 Chong Yidong <cyd@stupidchicken.com>
* subr.el (string-mark-left-to-right): New function. * subr.el (string-mark-left-to-right): New function.
......
...@@ -137,8 +137,10 @@ encryption is used." ...@@ -137,8 +137,10 @@ encryption is used."
context context
(cons #'epa-file-passphrase-callback-function (cons #'epa-file-passphrase-callback-function
local-file)) local-file))
(epg-context-set-progress-callback context (epg-context-set-progress-callback
#'epa-progress-callback-function) context
(cons #'epa-progress-callback-function
(format "Decrypting %s" file)))
(unwind-protect (unwind-protect
(progn (progn
(if replace (if replace
...@@ -211,8 +213,10 @@ encryption is used." ...@@ -211,8 +213,10 @@ encryption is used."
context context
(cons #'epa-file-passphrase-callback-function (cons #'epa-file-passphrase-callback-function
file)) file))
(epg-context-set-progress-callback context (epg-context-set-progress-callback
#'epa-progress-callback-function) context
(cons #'epa-progress-callback-function
(format "Encrypting %s" file)))
(epg-context-set-armor context epa-armor) (epg-context-set-armor context epa-armor)
(condition-case error (condition-case error
(setq string (setq string
......
...@@ -651,10 +651,17 @@ If SECRET is non-nil, list secret keys instead of public keys." ...@@ -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 (defun epa-progress-callback-function (_context what _char current total
handback) handback)
(message "%s%d%% (%d/%d)" (or handback (let ((prompt (or handback
(concat what ": ")) (format "Processing %s: " what))))
(if (> total 0) (floor (* (/ current (float total)) 100)) 0) ;; According to gnupg/doc/DETAIL: a "total" of 0 indicates that
current total)) ;; 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 ;;;###autoload
(defun epa-decrypt-file (file) (defun epa-decrypt-file (file)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment