]> code.delx.au - gnu-emacs/blobdiff - lisp/epa.el
Update copyright year to 2016
[gnu-emacs] / lisp / epa.el
index 8b952611243e9279f884e9cd20cb801b4df967b5..b0b016b7063c4386e393c01748e78bc0ecb5ff57 100644 (file)
@@ -1,6 +1,6 @@
 ;;; epa.el --- the EasyPG Assistant -*- lexical-binding: t -*-
 
-;; Copyright (C) 2006-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2016 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Keywords: PGP, GnuPG
@@ -249,7 +249,7 @@ You should bind this variable with `let', but do not set it globally.")
     (define-key keymap "q" 'delete-window)
     keymap))
 
-(defvar epa-exit-buffer-function #'bury-buffer)
+(defvar epa-exit-buffer-function #'quit-window)
 
 (define-widget 'epa-key 'push-button
   "Button for representing a epg-key object."
@@ -462,14 +462,12 @@ If ARG is non-nil, mark the key."
       (widget-create 'link
                     :notify (lambda (&rest _ignore) (abort-recursive-edit))
                     :help-echo
-                    (substitute-command-keys
-                     "Click here or \\[abort-recursive-edit] to cancel")
+                    "Click here or \\[abort-recursive-edit] to cancel"
                     "Cancel")
       (widget-create 'link
                     :notify (lambda (&rest _ignore) (exit-recursive-edit))
                     :help-echo
-                    (substitute-command-keys
-                     "Click here or \\[exit-recursive-edit] to finish")
+                    "Click here or \\[exit-recursive-edit] to finish"
                     "OK")
       (insert "\n\n")
       (epa--insert-keys keys)
@@ -658,7 +656,7 @@ If SECRET is non-nil, list secret keys instead of public keys."
        (if (= current total)
            (message "%s...done" prompt)
          (message "%s...%d%%" prompt
-                  (floor (* (/ current (float total)) 100))))
+                  (floor (* 100.0 current) total)))
       (message "%s..." prompt))))
 
 (defun epa-read-file-name (input)
@@ -776,13 +774,13 @@ If no one is selected, default secret key is used.  "
     (setf (epg-context-armor context) epa-armor)
     (setf (epg-context-textmode context) epa-textmode)
     (setf (epg-context-signers context) signers)
-    (setf (epg-context-passphrase-callback context)
-         #'epa-passphrase-callback-function)
-    (setf (epg-context-progress-callback context)
-         (cons
-          #'epa-progress-callback-function
-          (format "Signing %s..."
-                  (file-name-nondirectory file))))
+    (epg-context-set-passphrase-callback context
+                                        #'epa-passphrase-callback-function)
+    (epg-context-set-progress-callback context
+                                      (cons
+                                       #'epa-progress-callback-function
+                                       (format "Signing %s..."
+                                               (file-name-nondirectory file))))
     (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Signing %s..." (file-name-nondirectory file))
     (condition-case error
@@ -807,13 +805,13 @@ If no one is selected, symmetric encryption will be performed.  ")))
        (context (epg-make-context epa-protocol)))
     (setf (epg-context-armor context) epa-armor)
     (setf (epg-context-textmode context) epa-textmode)
-    (setf (epg-context-passphrase-callback context)
-         #'epa-passphrase-callback-function)
-    (setf (epg-context-progress-callback context)
-         (cons
-          #'epa-progress-callback-function
-          (format "Encrypting %s..."
-                  (file-name-nondirectory file))))
+    (epg-context-set-passphrase-callback context
+                                        #'epa-passphrase-callback-function)
+    (epg-context-set-progress-callback context
+                                      (cons
+                                       #'epa-progress-callback-function
+                                       (format "Encrypting %s..."
+                                               (file-name-nondirectory file))))
     (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Encrypting %s..." (file-name-nondirectory file))
     (condition-case error
@@ -843,20 +841,20 @@ should consider using the string based counterpart
 
 For example:
 
-\(let ((context (epg-make-context 'OpenPGP)))
+\(let ((context (epg-make-context \\='OpenPGP)))
   (decode-coding-string
     (epg-decrypt-string context (buffer-substring start end))
-    'utf-8))"
+    \\='utf-8))"
   (interactive "r")
   (save-excursion
     (let ((context (epg-make-context epa-protocol))
          plain)
-      (setf (epg-context-passphrase-callback context)
-           #'epa-passphrase-callback-function)
-      (setf (epg-context-progress-callback context)
-           (cons
-            #'epa-progress-callback-function
-            "Decrypting..."))
+      (epg-context-set-passphrase-callback context
+                                          #'epa-passphrase-callback-function)
+      (epg-context-set-progress-callback context
+                                        (cons
+                                         #'epa-progress-callback-function
+                                         "Decrypting..."))
       (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Decrypting...")
       (condition-case error
@@ -941,10 +939,10 @@ should consider using the string based counterpart
 
 For example:
 
-\(let ((context (epg-make-context 'OpenPGP)))
+\(let ((context (epg-make-context \\='OpenPGP)))
   (decode-coding-string
     (epg-verify-string context (buffer-substring start end))
-    'utf-8))"
+    \\='utf-8))"
   (declare (interactive-only t))
   (interactive "r")
   (let ((context (epg-make-context epa-protocol))
@@ -1030,10 +1028,10 @@ based counterpart `epg-sign-file' instead.
 
 For example:
 
-\(let ((context (epg-make-context 'OpenPGP)))
+\(let ((context (epg-make-context \\='OpenPGP)))
   (epg-sign-string
     context
-    (encode-coding-string (buffer-substring start end) 'utf-8)))"
+    (encode-coding-string (buffer-substring start end) \\='utf-8)))"
   (declare (interactive-only t))
   (interactive
    (let ((verbose current-prefix-arg))
@@ -1058,12 +1056,12 @@ If no one is selected, default secret key is used.  "
       ;;(setf (epg-context-textmode context) epa-textmode)
       (setf (epg-context-textmode context) t)
       (setf (epg-context-signers context) signers)
-      (setf (epg-context-passphrase-callback context)
-           #'epa-passphrase-callback-function)
-      (setf (epg-context-progress-callback context)
-           (cons
-            #'epa-progress-callback-function
-            "Signing..."))
+      (epg-context-set-passphrase-callback context
+                                          #'epa-passphrase-callback-function)
+      (epg-context-set-progress-callback context
+                                        (cons
+                                         #'epa-progress-callback-function
+                                         "Signing..."))
       (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Signing...")
       (condition-case error
@@ -1116,10 +1114,10 @@ file based counterpart `epg-encrypt-file' instead.
 
 For example:
 
-\(let ((context (epg-make-context 'OpenPGP)))
+\(let ((context (epg-make-context \\='OpenPGP)))
   (epg-encrypt-string
     context
-    (encode-coding-string (buffer-substring start end) 'utf-8)
+    (encode-coding-string (buffer-substring start end) \\='utf-8)
     nil))"
   (declare (interactive-only t))
   (interactive
@@ -1147,12 +1145,12 @@ If no one is selected, symmetric encryption will be performed.  ")
       (setf (epg-context-textmode context) t)
       (if sign
          (setf (epg-context-signers context) signers))
-      (setf (epg-context-passphrase-callback context)
-           #'epa-passphrase-callback-function)
-      (setf (epg-context-progress-callback context)
-           (cons
-            #'epa-progress-callback-function
-            "Encrypting..."))
+      (epg-context-set-passphrase-callback context
+                                          #'epa-passphrase-callback-function)
+      (epg-context-set-progress-callback context
+                                        (cons
+                                         #'epa-progress-callback-function
+                                         "Encrypting..."))
       (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Encrypting...")
       (condition-case error
@@ -1316,12 +1314,12 @@ If no one is selected, default public key is exported.  ")))
 ;;        (error "No keys selected"))
 ;;      (list keys current-prefix-arg)))
 ;;   (let ((context (epg-make-context epa-protocol)))
-;;     (setf (epg-context-passphrase-callback context)
-;;          #'epa-passphrase-callback-function)
-;;     (setf (epg-context-progress-callback context)
-;;          (cons
-;;            #'epa-progress-callback-function
-;;            "Signing keys..."))
+;;     (epg-context-set-passphrase-callback context
+;;                                         #'epa-passphrase-callback-function)
+;;     (epg-context-set-progress-callback context
+;;                                       (cons
+;;                                         #'epa-progress-callback-function
+;;                                         "Signing keys..."))
 ;;     (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
 ;;     (message "Signing keys...")
 ;;     (epg-sign-keys context keys local)