Commit 5224be2f authored by Daiki Ueno's avatar Daiki Ueno
Browse files

epg: Simplify epa-pinentry-mode handling

* epa-file.el (epa-file-insert-file-contents)
(epa-file-write-region): Remove redundant check of
epa-pinentry-mode.
* epa.el (epa-sign-file, epa-encrypt-file, epa-decrypt-region)
(epa-sign-region, epa-encrypt-region): Remove redundant check of
epa-pinentry-mode.
parent b12bb4dc
2014-11-18 Daiki Ueno <ueno@gnu.org>
* epa-file.el (epa-file-insert-file-contents)
(epa-file-write-region): Remove redundant check of
epa-pinentry-mode.
* epa.el (epa-sign-file, epa-encrypt-file, epa-decrypt-region)
(epa-sign-region, epa-encrypt-region): Remove redundant check of
epa-pinentry-mode.
2014-11-18 Daiki Ueno <ueno@gnu.org> 2014-11-18 Daiki Ueno <ueno@gnu.org>
   
* epa-file.el (epa-file-insert-file-contents): Don't show * epa-file.el (epa-file-insert-file-contents): Don't show
......
...@@ -144,8 +144,7 @@ encryption is used." ...@@ -144,8 +144,7 @@ encryption is used."
context context
(cons #'epa-progress-callback-function (cons #'epa-progress-callback-function
(format "Decrypting %s" file))) (format "Decrypting %s" file)))
(if epa-pinentry-mode (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
(setf (epg-context-pinentry-mode context) epa-pinentry-mode))
(unwind-protect (unwind-protect
(progn (progn
(if replace (if replace
...@@ -233,8 +232,7 @@ encryption is used." ...@@ -233,8 +232,7 @@ encryption is used."
(cons #'epa-progress-callback-function (cons #'epa-progress-callback-function
(format "Encrypting %s" file))) (format "Encrypting %s" file)))
(setf (epg-context-armor context) epa-armor) (setf (epg-context-armor context) epa-armor)
(if epa-pinentry-mode (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
(setf (epg-context-pinentry-mode context) epa-pinentry-mode))
(condition-case error (condition-case error
(setq string (setq string
(epg-encrypt-string (epg-encrypt-string
......
...@@ -783,8 +783,7 @@ If no one is selected, default secret key is used. " ...@@ -783,8 +783,7 @@ If no one is selected, default secret key is used. "
#'epa-progress-callback-function #'epa-progress-callback-function
(format "Signing %s..." (format "Signing %s..."
(file-name-nondirectory file)))) (file-name-nondirectory file))))
(if epa-pinentry-mode (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
(setf (epg-context-pinentry-mode context) epa-pinentry-mode))
(message "Signing %s..." (file-name-nondirectory file)) (message "Signing %s..." (file-name-nondirectory file))
(condition-case error (condition-case error
(epg-sign-file context file signature mode) (epg-sign-file context file signature mode)
...@@ -815,8 +814,7 @@ If no one is selected, symmetric encryption will be performed. "))) ...@@ -815,8 +814,7 @@ If no one is selected, symmetric encryption will be performed. ")))
#'epa-progress-callback-function #'epa-progress-callback-function
(format "Encrypting %s..." (format "Encrypting %s..."
(file-name-nondirectory file)))) (file-name-nondirectory file))))
(if epa-pinentry-mode (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
(setf (epg-context-pinentry-mode context) epa-pinentry-mode))
(message "Encrypting %s..." (file-name-nondirectory file)) (message "Encrypting %s..." (file-name-nondirectory file))
(condition-case error (condition-case error
(epg-encrypt-file context file recipients cipher) (epg-encrypt-file context file recipients cipher)
...@@ -859,8 +857,7 @@ For example: ...@@ -859,8 +857,7 @@ For example:
(cons (cons
#'epa-progress-callback-function #'epa-progress-callback-function
"Decrypting...")) "Decrypting..."))
(if epa-pinentry-mode (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
(setf (epg-context-pinentry-mode context) epa-pinentry-mode))
(message "Decrypting...") (message "Decrypting...")
(condition-case error (condition-case error
(setq plain (epg-decrypt-string context (buffer-substring start end))) (setq plain (epg-decrypt-string context (buffer-substring start end)))
...@@ -1067,8 +1064,7 @@ If no one is selected, default secret key is used. " ...@@ -1067,8 +1064,7 @@ If no one is selected, default secret key is used. "
(cons (cons
#'epa-progress-callback-function #'epa-progress-callback-function
"Signing...")) "Signing..."))
(if epa-pinentry-mode (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
(setf (epg-context-pinentry-mode context) epa-pinentry-mode))
(message "Signing...") (message "Signing...")
(condition-case error (condition-case error
(setq signature (epg-sign-string context (setq signature (epg-sign-string context
...@@ -1157,8 +1153,7 @@ If no one is selected, symmetric encryption will be performed. ") ...@@ -1157,8 +1153,7 @@ If no one is selected, symmetric encryption will be performed. ")
(cons (cons
#'epa-progress-callback-function #'epa-progress-callback-function
"Encrypting...")) "Encrypting..."))
(if epa-pinentry-mode (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
(setf (epg-context-pinentry-mode context) epa-pinentry-mode))
(message "Encrypting...") (message "Encrypting...")
(condition-case error (condition-case error
(setq cipher (epg-encrypt-string context (setq cipher (epg-encrypt-string context
...@@ -1327,8 +1322,7 @@ If no one is selected, default public key is exported. "))) ...@@ -1327,8 +1322,7 @@ If no one is selected, default public key is exported. ")))
;; (cons ;; (cons
;; #'epa-progress-callback-function ;; #'epa-progress-callback-function
;; "Signing keys...")) ;; "Signing keys..."))
;; (if epa-pinentry-mode ;; (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
;; (setf (epg-context-pinentry-mode context) epa-pinentry-mode))
;; (message "Signing keys...") ;; (message "Signing keys...")
;; (epg-sign-keys context keys local) ;; (epg-sign-keys context keys local)
;; (message "Signing keys...done"))) ;; (message "Signing keys...done")))
......
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