unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch-emacs-mua: avoid extra separators at the end of the line
@ 2023-11-30 16:13 Jani Nikula
  2023-11-30 17:12 ` Tomi Ollila
  2023-12-01 12:27 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Jani Nikula @ 2023-11-30 16:13 UTC (permalink / raw)
  To: notmuch

Currently the --to/--cc/--bcc options add "user@example.com, " to the
message headers, with the the unnecessary ", " separator after the
last address, regardless of how many addresses are being added.

This used to be fine, but with recent emacs mm, trying to send the
email with the trailing commas leads to prompt:

  Email address  looks invalid; send anyway? (y or n)

Fix this by only adding the commas between addresses, avoiding the
trailing commas.
---
 emacs/notmuch-emacs-mua | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-emacs-mua b/emacs/notmuch-emacs-mua
index a521497784ec..254e6407cece 100755
--- a/emacs/notmuch-emacs-mua
+++ b/emacs/notmuch-emacs-mua
@@ -41,6 +41,9 @@ CREATE_FRAME=
 ELISP=
 MAILTO=
 HELLO=
+TO_SEP=
+CC_SEP=
+BCC_SEP=
 
 # Short options compatible with mutt(1).
 while getopts :s:c:b:i:h opt; do
@@ -86,13 +89,16 @@ while getopts :s:c:b:i:h opt; do
 	    ELISP="${ELISP} (message-goto-subject) (insert \"${OPTARG}\")"
 	    ;;
 	--to)
-	    ELISP="${ELISP} (message-goto-to) (insert \"${OPTARG}, \")"
+	    ELISP="${ELISP} (message-goto-to) (insert \"${TO_SEP}${OPTARG}\")"
+	    TO_SEP=", "
 	    ;;
 	--cc|c)
-	    ELISP="${ELISP} (message-goto-cc) (insert \"${OPTARG}, \")"
+	    ELISP="${ELISP} (message-goto-cc) (insert \"${CC_SEP}${OPTARG}\")"
+	    CC_SEP=", "
 	    ;;
 	--bcc|b)
-	    ELISP="${ELISP} (message-goto-bcc) (insert \"${OPTARG}, \")"
+	    ELISP="${ELISP} (message-goto-bcc) (insert \"${BCC_SEP}${OPTARG}\")"
+	    BCC_SEP=", "
 	    ;;
 	--body|i)
 	    ELISP="${ELISP} (message-goto-body) (insert-file \"${OPTARG}\")"
-- 
2.39.2

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

* Re: [PATCH] notmuch-emacs-mua: avoid extra separators at the end of the line
  2023-11-30 16:13 [PATCH] notmuch-emacs-mua: avoid extra separators at the end of the line Jani Nikula
@ 2023-11-30 17:12 ` Tomi Ollila
  2023-12-01 12:27 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2023-11-30 17:12 UTC (permalink / raw)
  To: Jani Nikula, notmuch

On Thu, Nov 30 2023, Jani Nikula wrote:

> Currently the --to/--cc/--bcc options add "user@example.com, " to the
> message headers, with the the unnecessary ", " separator after the
> last address, regardless of how many addresses are being added.
>
> This used to be fine, but with recent emacs mm, trying to send the
> email with the trailing commas leads to prompt:
>
>   Email address  looks invalid; send anyway? (y or n)
>
> Fix this by only adding the commas between addresses, avoiding the
> trailing commas.

LGTM.

Tomi


> ---
>  emacs/notmuch-emacs-mua | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-emacs-mua b/emacs/notmuch-emacs-mua
> index a521497784ec..254e6407cece 100755
> --- a/emacs/notmuch-emacs-mua
> +++ b/emacs/notmuch-emacs-mua
> @@ -41,6 +41,9 @@ CREATE_FRAME=
>  ELISP=
>  MAILTO=
>  HELLO=
> +TO_SEP=
> +CC_SEP=
> +BCC_SEP=
>  
>  # Short options compatible with mutt(1).
>  while getopts :s:c:b:i:h opt; do
> @@ -86,13 +89,16 @@ while getopts :s:c:b:i:h opt; do
>  	    ELISP="${ELISP} (message-goto-subject) (insert \"${OPTARG}\")"
>  	    ;;
>  	--to)
> -	    ELISP="${ELISP} (message-goto-to) (insert \"${OPTARG}, \")"
> +	    ELISP="${ELISP} (message-goto-to) (insert \"${TO_SEP}${OPTARG}\")"
> +	    TO_SEP=", "
>  	    ;;
>  	--cc|c)
> -	    ELISP="${ELISP} (message-goto-cc) (insert \"${OPTARG}, \")"
> +	    ELISP="${ELISP} (message-goto-cc) (insert \"${CC_SEP}${OPTARG}\")"
> +	    CC_SEP=", "
>  	    ;;
>  	--bcc|b)
> -	    ELISP="${ELISP} (message-goto-bcc) (insert \"${OPTARG}, \")"
> +	    ELISP="${ELISP} (message-goto-bcc) (insert \"${BCC_SEP}${OPTARG}\")"
> +	    BCC_SEP=", "
>  	    ;;
>  	--body|i)
>  	    ELISP="${ELISP} (message-goto-body) (insert-file \"${OPTARG}\")"
> -- 
> 2.39.2
>
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

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

* Re: [PATCH] notmuch-emacs-mua: avoid extra separators at the end of the line
  2023-11-30 16:13 [PATCH] notmuch-emacs-mua: avoid extra separators at the end of the line Jani Nikula
  2023-11-30 17:12 ` Tomi Ollila
@ 2023-12-01 12:27 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2023-12-01 12:27 UTC (permalink / raw)
  To: Jani Nikula, notmuch

Jani Nikula <jani@nikula.org> writes:

> Currently the --to/--cc/--bcc options add "user@example.com, " to the
> message headers, with the the unnecessary ", " separator after the
> last address, regardless of how many addresses are being added.
>
> This used to be fine, but with recent emacs mm, trying to send the
> email with the trailing commas leads to prompt:
>
>   Email address  looks invalid; send anyway? (y or n)
>
> Fix this by only adding the commas between addresses, avoiding the
> trailing commas.

applied to master, released as part of 0.38.2

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

end of thread, other threads:[~2023-12-01 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-30 16:13 [PATCH] notmuch-emacs-mua: avoid extra separators at the end of the line Jani Nikula
2023-11-30 17:12 ` Tomi Ollila
2023-12-01 12:27 ` David Bremner

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

	https://yhetil.org/notmuch.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).