From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GCOzKlFZoWLArAAAbAwnHQ (envelope-from ) for ; Thu, 09 Jun 2022 04:22:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id gH6aKlFZoWJehgEA9RJhRA (envelope-from ) for ; Thu, 09 Jun 2022 04:22:09 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7146612F20 for ; Thu, 9 Jun 2022 04:22:09 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id B50425F7AC; Thu, 9 Jun 2022 02:12:19 +0000 (UTC) Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by mail.notmuchmail.org (Postfix) with ESMTPS id 521CC5F7A9 for ; Thu, 9 Jun 2022 02:12:16 +0000 (UTC) Received: from fencepost.gnu.org ([2001:470:142:3::e]:46516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nz7eg-0004SF-Ky; Wed, 08 Jun 2022 22:12:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=QFZca6QnAgG5Qnu6RVIUr4TCQk5/1C1rGnwebquDXUE=; b=j1YPG2yEix1y7S8yu4MZ pmv7pLmdGU1fTki0eI3ztKIrEdB0Xc86iLr+Orkl06TNELd/A3vCZqGthzeNmeZBk7rsIUC8gSecF yHNL9VJv9okVJbtQnYDZCDr0wmE9bCHi93j+pjBHA3bxfADhX3A0K6+obMYaoKSDAqJnqi1X7FY0g btZlK66K15IhCNymrGKTKkLz98jEdo9DwJ0Ku+4lbqUSKPin8IjVAzuZVHp8+lHF6EQIq5YzltRqk Eu1U/CkeJ6YiystDkzcRlR8QiV1I6/mQMbINFoS6UA85WWuwI9cmSO+HPrAdNWvibouWV9r0t/4sF eXtrTCCmKyLjHg==; Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:44290 helo=rivendell.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nz7ef-0004MS-Of; Wed, 08 Jun 2022 22:12:14 -0400 Received: from localhost (rivendell.localdomain [local]) by rivendell.localdomain (OpenSMTPD) with ESMTPA id 1366b5e4; Thu, 9 Jun 2022 02:12:11 +0000 (UTC) From: Jose A Ortega Ruiz To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH v2] emacs: use message-dont-reply-to-names when composing replies In-Reply-To: <8735ge1vs9.fsf@tethera.net> References: <20220604202127.2379152-1-jao@gnu.org> <8735ge1vs9.fsf@tethera.net> X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: Date: Thu, 09 Jun 2022 03:12:11 +0100 Message-ID: <87v8ta60w4.fsf@mail.jao.io> MIME-Version: 1.0 Message-ID-Hash: MXGWEPGKABUJLYEIFPOZ4LPJSCY3INB3 X-Message-ID-Hash: MXGWEPGKABUJLYEIFPOZ4LPJSCY3INB3 X-MailFrom: jao@gnu.org 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; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654741329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=UUWWU8uhGfoqu50MaMAutqNVo/GL8DBHs9VgvCv8GOc=; b=lOB4Ges9kXmvFnrjwokQY8rvUnXV1208j9+MI4Ce4W19Mm2P0MY6xQtRyW79gA+b0SCQ4J 1XOa56car2xmfP2Zkl2wxbG+eQQnm8VDl27HYYvT2c87ohtDyiu0PIVGyA3k7tLPhFPF4y 7WC1oCpdi3f5qIYXvceb2ylYdYSqRRuzURzWdPv/9sbjIftEvNiJZbjtGh97Tb1GfdoHu9 SCuY/3zAwsMnHusZXrCnSElfA32scQqRVypuAxz12wFW45woxs1koQlZ1msb64x543U+GX jhkIBBqzmeia0bcBIMzsDSDmD0MSK7uUbMHLR3MBCIgHtXPOtPACvtJj5gCuOg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654741329; a=rsa-sha256; cv=none; b=uOY+3UJTLTCCGkFrTS//H12LjX2lgKLYeLevMo107jiX6jMLjoZ73Rjppx4Kuu8962DYev wNoTuHbDv6FKfh1KQoPsCpmqapyD1DRWy+mW/1/zwCa2fh4XMHO59h0g9Xng9McrSY/xru 8JvQWEXuPl5QdoKAQTeinWNXG7UpBoRnGHsWhx/8tP7SucJzXcxsURPJ0DXzppI9vIZmvR 773Jk8IIyS+LoQxYrHSZ4UkZiYfXfoaNFHw0xf7vki+R8uZ+H5l7NlJrBt/5n3bWJLce04 5FoOy/6pdadXqbjOjXd+jz6bpHMcptNJWbrtgND61D8dVZWOfF6cy6CeSM6qog== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=j1YPG2yE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 6.49 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gnu.org header.s=fencepost-gnu-org header.b=j1YPG2yE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gnu.org (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 7146612F20 X-Spam-Score: 6.49 X-Migadu-Scanner: scn1.migadu.com X-TUID: p2porC86j1+Y On Wed, Jun 08 2022, David Bremner wrote: > jao writes: > >> >> >> +(defun notmuch-mua--remove-dont-reply-to-names () >> + (when-let ((nr (message-dont-reply-to-names))) > > Using when-let is fine with me, but I wonder if we should follow the > advice in subr-x to do > > (eval-when-compile (require 'subr-x)) > > It's autoloaded, but maybe we can improve loading time a little? > I noticed the other places we just do (require 'subr-x), but we're not > always the most *cough* sophisticated elisp programmers. well, i'd be surprised if it made any noticeable difference, but it surely won't hurt. added. > I'm a bit nervous about calling an undocumented defsubst here. It might > be better to inline the 3 line definition. What do you think? in all fairness, its name doesn't include a double dash, so that makes it theoretically public. but it's true it's undocumented, and, if inlining makes the code clearer without having to add explanatory messages, i think inlining is a net win. done. >> + (dolist (header '("To" "Cc")) > > I found the re-use of v confusing in this 'when-let'. It reminds me of > an exam question about scope :). i'll change it, no problem. > >> + (when-let ((v (message-fetch-field header))) >> + (let* ((v (mapcar #'string-trim (message-tokenize-header v))) >> + (vs (delq nil (mapcar nr-filter v))) >> + (v (when vs (mapconcat #'identity vs ", ")))) > > I think 'and' is conventional for places where we care about what the > expression evaluates to, and 'when' preferred when not. fair enough. i've removed also similar usages of 'unless'. [...] >> @@ -0,0 +1,76 @@ >> +#!/usr/bin/env bash >> + >> +test_description="emacs reply" > > I guess this description should match the name of the file and mention > something like "don't reply"; this will make the individual test > descriptions make more sense oops yes, forgot to update it. >> +. $(dirname "$0")/test-lib.sh || exit 1 >> +. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1 >> + >> +EXPECTED=$NOTMUCH_SRCDIR/test/emacs-show.expected-output >> + >> +test_require_emacs >> + >> +add_email_corpus default >> + >> +test_begin_subtest "regular expression" >> +test_emacs '(let ((message-dont-reply-to-names "notmuchmail\\|noreply\\|harvard")) >> + (notmuch-mua-new-reply >> + "id:20091117203301.GV3165@dottiness.seas.harvard.edu" nil t) >> + (test-visible-output "OUTPUT-FULL.raw"))' >> + > > Maybe mention this tests Cc; I don't _think_ the other tests do? they actually do: they make it disappear! i'm submitting a new version with the changes above: let me know how it looks. jao