emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105431: Make epa-file progress messa


From: Daiki Ueno
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105431: Make epa-file progress message user-friendly.
Date: Fri, 12 Aug 2011 12:30:18 +0900
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105431
committer: Daiki Ueno <address@hidden>
branch nick: trunk
timestamp: Fri 2011-08-12 12:30:18 +0900
message:
  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.
modified:
  lisp/ChangeLog
  lisp/epa-file.el
  lisp/epa.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-08-10 19:03:56 +0000
+++ b/lisp/ChangeLog    2011-08-12 03:30:18 +0000
@@ -1,3 +1,11 @@
+2011-08-12  Daiki Ueno  <address@hidden>
+
+       * 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  <address@hidden>
 
        * subr.el (string-mark-left-to-right): New function.

=== modified file 'lisp/epa-file.el'
--- a/lisp/epa-file.el  2011-04-04 06:16:23 +0000
+++ b/lisp/epa-file.el  2011-08-12 03:30:18 +0000
@@ -137,8 +137,10 @@
      context
      (cons #'epa-file-passphrase-callback-function
           local-file))
-    (epg-context-set-progress-callback context
-                                      #'epa-progress-callback-function)
+    (epg-context-set-progress-callback
+     context
+     (cons #'epa-progress-callback-function
+          (format "Decrypting %s" file)))
     (unwind-protect
        (progn
          (if replace
@@ -211,8 +213,10 @@
      context
      (cons #'epa-file-passphrase-callback-function
           file))
-    (epg-context-set-progress-callback context
-                                      #'epa-progress-callback-function)
+    (epg-context-set-progress-callback
+     context
+     (cons #'epa-progress-callback-function
+          (format "Encrypting %s" file)))
     (epg-context-set-armor context epa-armor)
     (condition-case error
        (setq string

=== modified file 'lisp/epa.el'
--- a/lisp/epa.el       2011-04-04 06:16:23 +0000
+++ b/lisp/epa.el       2011-08-12 03:30:18 +0000
@@ -651,10 +651,17 @@
 
 (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]