]> git.eshelyaron.com Git - emacs.git/commitdiff
Make the error message in epa-display-error more helpful
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 4 Dec 2021 04:39:25 +0000 (05:39 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 4 Dec 2021 04:39:25 +0000 (05:39 +0100)
* lisp/epa.el (epa-display-error): Output a more helpful error
message when reading a keyring file (bug#12923).

lisp/epa.el

index e4b89e984d21a3ddb5104d42269a61daff11f9af..93c85bfd37cd86f69b136a88474d8eb7ecf5439b 100644 (file)
@@ -607,7 +607,11 @@ If SECRET is non-nil, list secret keys instead of public keys."
                       (_ "Error while executing \"%s\":\n\n"))
                     (epg-context-program context))
                    "\n\n"
-                   (epg-context-error-output context)))
+                   (epg-context-error-output context)
+                    (if (string-search "Unexpected error"
+                                       (epg-context-error-output context))
+                        "\n(File possibly not an encrypted file, but is perhaps a key ring file?)\n"
+                      "")))
          (epa-info-mode)
          (goto-char (point-min)))
        (display-buffer buffer)))))