From: Karl Fogel <kfogel@red-bean.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: [PATCH] Improve signer name error in `mml-secure-epg-sign'.
Date: Mon, 04 Nov 2019 14:38:00 -0600 [thread overview]
Message-ID: <87tv7j74yf.fsf@red-bean.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]
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
[-- Attachment #2: mml-sec-signer-name-error-message-improvement.txt --]
[-- Type: text/plain, Size: 844 bytes --]
[[[
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)
next reply other threads:[~2019-11-04 20:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 20:38 Karl Fogel [this message]
2019-11-09 20:38 ` [PATCH] Improve signer name error in `mml-secure-epg-sign' Karl Fogel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tv7j74yf.fsf@red-bean.com \
--to=kfogel@red-bean.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.