* auth-source.el (with-auth-source-epa-overrides): Don't depend on the EPA variables...
authorTed Zlatanov <tzz@lifelogs.com>
Thu, 16 Jun 2011 04:28:00 +0000 (23:28 -0500)
committerTed Zlatanov <tzz@lifelogs.com>
Thu, 16 Jun 2011 04:28:00 +0000 (23:28 -0500)
lisp/ChangeLog
lisp/auth-source.el

index 6052296..b608c53 100644 (file)
@@ -4,7 +4,8 @@
        secret tokens should be saved encrypted.
        (auth-source-netrc-parse, auth-source-netrc-search): Pass the file name
        to `auth-source-netrc-normalize'.
-       (with-auth-source-epa-overrides): Add convenience macro.
+       (with-auth-source-epa-overrides): Add convenience macro.  Don't depend
+       on the EPA variables being defined.
        (auth-source-epa-make-gpg-token): Convert text to a "gpg:" token.
        (auth-source-netrc-normalize): Convert "gpg:" tokens back to text in
        the lexical-let closure.
index 904d523..83e12d6 100644 (file)
@@ -956,11 +956,17 @@ Note that the MAX parameter is used so we can exit the parse early."
 
 (defmacro with-auth-source-epa-overrides (&rest body)
   `(let ((file-name-handler-alist
-          ',(remove epa-file-handler file-name-handler-alist))
+          ',(if (boundp 'epa-file-handler)
+                (remove (symbol-value 'epa-file-handler)
+                        file-name-handler-alist)
+              file-name-handler-alist))
          (find-file-hook
           ',(remove 'epa-file-find-file-hook find-file-hook))
          (auto-mode-alist
-          ',(remove epa-file-auto-mode-alist-entry auto-mode-alist)))
+          ',(if (boundp 'epa-file-auto-mode-alist-entry)
+                (remove (symbol-value 'epa-file-auto-mode-alist-entry)
+                        auto-mode-alist)
+              auto-mode-alist)))
      ,@body))
 
 (defun auth-source-epa-make-gpg-token (secret file)