notmuch.git  about / heads / tags
Unnamed repository; edit this file 'description' to name the repository.
   commit 67990376b7e03f2ca4b78569b143713b76b6e946 (patch)
   parent 4f82acce lib/string_map: simulate stable sorting
     tree 89a2418d6e3aee34f568dfdd8d1795a6089392ed
   author Jani Nikula <jani@nikula.org>      2023-11-30 18:13:19 +0200
committer David Bremner <david@tethera.net>  2023-12-01 07:22:26 -0400

notmuch-emacs-mua: avoid extra separators at the end of the line

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 a5214977..254e6407 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}\")"


glossary
--------
Commit objects reference one tree, and zero or more parents.

Single parent commits can typically generate a patch in
unified diff format via `git format-patch'.

Multiple parents means the commit is a merge.

Root commits have no ancestor.  Note that it is
possible to have multiple root commits when merging independent histories.

Every commit references one top-level tree object.

git clone https://yhetil.org/notmuch.git