]> code.delx.au - gnu-emacs/blobdiff - lisp/epa-file.el
* lisp/descr-text.el (describe-char-unicode-data): Fix copy/paste errors.
[gnu-emacs] / lisp / epa-file.el
index cdaa8ba5f3d457a1feba0e901403a5f3e58f41aa..ee502ef64a3262fc6dc15b9243cb4545672e6ffb 100644 (file)
@@ -1,5 +1,5 @@
 ;;; epa-file.el --- the EasyPG Assistant, transparent file encryption -*- 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
@@ -82,12 +82,15 @@ encryption is used."
                passphrase))))
     (epa-passphrase-callback-function context key-id file)))
 
+(defvar epa-inhibit nil
+  "Non-nil means don't try to decrypt .gpg files when operating on them.")
+
 ;;;###autoload
 (defun epa-file-handler (operation &rest args)
   (save-match-data
     (let ((op (get operation 'epa-file)))
-      (if op
-         (apply op args)
+      (if (and op (not epa-inhibit))
+          (apply op args)
        (epa-file-run-real-handler operation args)))))
 
 (defun epa-file-run-real-handler (operation args)
@@ -144,8 +147,7 @@ encryption is used."
      context
      (cons #'epa-progress-callback-function
           (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
        (progn
          (if replace
@@ -233,8 +235,7 @@ encryption is used."
      (cons #'epa-progress-callback-function
           (format "Encrypting %s" file)))
     (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
        (setq string
              (epg-encrypt-string