[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Improve signer name error in `mml-secure-epg-sign'.
From: |
Karl Fogel |
Subject: |
[PATCH] Improve signer name error in `mml-secure-epg-sign'. |
Date: |
Mon, 04 Nov 2019 14:38:00 -0600 |
I hope someone with more expertise in this code can review and possibly improve
this patch.
Recently I got this error message when trying to send a GPG-signed message:
"Couldn't find any signer names. Perhaps `mml-secure-smime-sign-with-sender'
should be set?"
However, `mml-secure-smime-sign-with-sender' was already set to t (the actual
problem lies elsewhere and I'm still debugging it). Since Emacs can know that
`mml-secure-smime-sign-with-sender' is set, there's no reason for the error
message to send the user down the wrong road. The attached patch
conditionalizes the error message accordingly.
I believe this patch could be improved by offering the user more advice if a
signer cannot be found. For example, maybe the user should look at setting
`mm-sign-option' to `guided'? However, I am not an expert in this; my setup
(with `mml-secure-smime-sign-with-sender' set to t) had been working fine for
years and then suddenly broke, so I'm now debugging. It's just that near the
beginning of my debugging, Emacs presented me with a misleading error message
-- hence this patch, so others can at least avoid that false start. Further
suggestions or improvements welcome.
Best regards,
-Karl
[[[
Improve an error message about message signer
* lisp/gnus/mml-sec.el (mml-secure-epg-sign): Don't suggest setting
`mml-secure-smime-sign-with-sender' if it's already non-nil.
]]]
--- lisp/gnus/mml-sec.el
+++ lisp/gnus/mml-sec.el
@@ -945,7 +945,11 @@ mml-secure-epg-sign
(signers (mml-secure-signers context signer-names))
signature micalg)
(unless signers
- (error "Couldn't find any signer names. Perhaps
`mml-secure-smime-sign-with-sender' should be set?"))
+ (let ((maybe-msg
+ (if mml-secure-smime-sign-with-sender
+ "."
+ "; try setting `mml-secure-smime-sign-with-sender'.")))
+ (error "Couldn't find any signer names%s" maybe-msg)))
(when (eq 'OpenPGP protocol)
(setf (epg-context-armor context) t)
(setf (epg-context-textmode context) t)
- [PATCH] Improve signer name error in `mml-secure-epg-sign'.,
Karl Fogel <=