From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EKb9N2s9O18edwAA0tVLHw (envelope-from ) for ; Tue, 18 Aug 2020 02:31:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4HGiM2s9O18wdgAAbx9fmQ (envelope-from ) for ; Tue, 18 Aug 2020 02:31:07 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7E438940142 for ; Tue, 18 Aug 2020 02:31:05 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6B91A29BBF; Mon, 17 Aug 2020 22:30:57 -0400 (EDT) X-Greylist: delayed 486 seconds by postgrey-1.36 at nmbug; Mon, 17 Aug 2020 22:30:53 EDT Received: from smtprelay.hostedemail.com (smtprelay0115.hostedemail.com [216.40.44.115]) by mail.notmuchmail.org (Postfix) with ESMTPS id D036F1FC8D for ; Mon, 17 Aug 2020 22:30:53 -0400 (EDT) Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave08.hostedemail.com (Postfix) with ESMTP id 47E44182D5130 for ; Tue, 18 Aug 2020 02:22:47 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 11F72180A7FEB for ; Tue, 18 Aug 2020 02:22:45 +0000 (UTC) X-Session-Marker: 74696D40747175656C63682E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,tim@tquelch.com,,RULES_HIT:41:355:379:967:973:988:989:1260:1277:1313:1314:1345:1381:1437:1516:1518:1534:1541:1711:1730:1747:1777:1792:2393:2525:2560:2563:2682:2685:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4362:5007:6117:6119:6261:7903:9025:10004:10400:10450:10455:10848:11658:11914:12043:12297:12555:12986:13053:13069:13071:13095:13161:13229:13311:13357:14180:14181:14721:19904:19999:21060:21063:21080:21212:21433:21451:21627:21660:21740:30054,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: toys75_13119792701b X-Filterd-Recvd-Size: 1650 Received: from localhost (unknown [173.244.36.69]) (Authenticated sender: tim@tquelch.com) by omf10.hostedemail.com (Postfix) with ESMTPA for ; Tue, 18 Aug 2020 02:22:43 +0000 (UTC) From: Tim Quelch To: notmuch@notmuchmail.org Subject: emacs: `message-send-hook` being called twice Date: Tue, 18 Aug 2020 12:23:24 +1000 Message-ID: <87mu2swv37.fsf@quelch.name> MIME-Version: 1.0 Message-ID-Hash: W2QUEQ3TFAWSWK5C5VNZTY4HKMUGSXL4 X-Message-ID-Hash: W2QUEQ3TFAWSWK5C5VNZTY4HKMUGSXL4 X-MailFrom: tim@tquelch.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=tquelch.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 0.63 X-TUID: kcD4hvm5lLLG Hi all, I've been working through a bug that I've been having with org-msg (https://github.com/jeremy-compostella/org-msg/issues/58#issuecomment-675177076) and it looks like a bug in the internals of notmuch. It appears as though the `message-send-hooks` are being called twice, 1. In `notmuch-mua-send-common` when `notmuch-mua-send-hook` are run (which by default is set to `notmuch-mua-message-send-hook`, which just runs `message-send-hook`) 2. When `notmuch-mua-send-common` delegates sending of the message to `message-send` or `message-send-and-exit`. These functions both run `message-send-hook` The specific issue this was causing in org-msg was that the message was being converted to html twice, causing raw html to be included in the sent message. This kind of issue could easily pop up again with other non-idempotent hook functions. I was wondering what the design descision was to set up `notmuch-mua-send-hook` to delegate to running `message-send-hook` when this is already done in `message-send` If this was not intentional, I don't think `notmuch-mua-send-hook` needs to contain `notmuch-mua-message-send-hook` by default. Thanks, Tim