Make the error message in epa-display-error more helpful

* lisp/epa.el (epa-display-error): Output a more helpful error
message when reading a keyring file (bug#12923).
This commit is contained in:
Lars Ingebrigtsen 2021-12-04 05:39:25 +01:00
parent 55ff91e822
commit 644dd2f050

View 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)))))