unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Improve signer name error in `mml-secure-epg-sign'.
@ 2019-11-04 20:38 Karl Fogel
  2019-11-09 20:38 ` Karl Fogel
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Fogel @ 2019-11-04 20:38 UTC (permalink / raw)
  To: Emacs developers

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Improve signer name error in `mml-secure-epg-sign'.
  2019-11-04 20:38 [PATCH] Improve signer name error in `mml-secure-epg-sign' Karl Fogel
@ 2019-11-09 20:38 ` Karl Fogel
  0 siblings, 0 replies; 2+ messages in thread
From: Karl Fogel @ 2019-11-09 20:38 UTC (permalink / raw)
  To: Emacs developers

Committed (06cb8350c69d).  If anyone knows ways to further improve the error message, please go for it.

Best regards,
-Karl

> 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-09 20:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-04 20:38 [PATCH] Improve signer name error in `mml-secure-epg-sign' Karl Fogel
2019-11-09 20:38 ` Karl Fogel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).