From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id aLsjHTWdGmWDVwEA9RJhRA:P1 (envelope-from ) for ; Mon, 02 Oct 2023 12:36:37 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aLsjHTWdGmWDVwEA9RJhRA (envelope-from ) for ; Mon, 02 Oct 2023 12:36:37 +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 E2BFA52C65 for ; Mon, 2 Oct 2023 12:36:36 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=PwD+7yY5; 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; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696242997; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc: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=AHIDGn63OaWW7gbR4On1GJXAUgPWtVcnc3zsM/OLr9I=; b=EZbYPhGklywlM4LXZ3ramJa1Ft9Enijvjnfs8tz+lfAiW9mFgOlDcHVICQbzH6HcdSDQRX f4pEyaEZ64sdKJqVvLWZsjOoHzCoYfMcoqXZdcmAgvN2FIw1i55z6bnzvACgjPMdwYvCf8 YgQfvqjpYLnAcVM4b07vzSJ7DB4Rv/U2vCIa0oixTDABwkvYOcDDhmTAP1Vz2IV/gbg3i1 /bqR03GJoDZl/TQXDjKjLz1Rx30xMT6djxpST0A1KP4qnk8ziyp78mDs56XNA6oBUHR8++ RNhdkMvUgZQuMjZ7oJLvmWG/i6xXSclGKU9/FfbdEMpKNlSCiGejnLumwu/p4g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=PwD+7yY5; 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; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696242997; a=rsa-sha256; cv=none; b=R+xONrDYbMjsbnZst/hutzrO6za9ti5NsRdKYVW9lvoGYh59oGydx+KolRkCFjO5pqJMGN t0zqJh/+12/JnOTm6gXFNQJo+oswnnw4Ok50PmM33u1p28JKnXfKkDl1GgXkS/VL1LVuE3 B1dApA+f2xCKFZ83K8GdgQ5w3Tocw6irypmE4ep5k7bt1oAuzPlIZjf1gHFo+h/O3JnPej E734fuUXghHLns5GYCMNfYaMY8qD52+G8pETJh2HMOYxjevTbtBx7xKUK4lanDXzkgQ9AB AXaMlxqdgHlKEXr663tbj68EpQ4bOLUKDxB0zyM5xzTyavEeIE0uLn/UYStzHQ== Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id B81455F781; Mon, 2 Oct 2023 10:29:09 +0000 (UTC) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by mail.notmuchmail.org (Postfix) with ESMTPS id 093115F4A8 for ; Mon, 2 Oct 2023 10:29:07 +0000 (UTC) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9ae3d4c136fso441756666b.1 for ; Mon, 02 Oct 2023 03:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696242546; x=1696847346; darn=notmuchmail.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Dl56URatrCxYY5LpaqZot1EYcHH+XdJPTh0UJ56itT8=; b=PwD+7yY58PjTgmuRrhLVRR/N+6wwwKKX2lBCiXfvRQXCxkifSGHaa0lU2vCPbnZ1aa JRbKfy23tmPZ2iu1sOal0xttnNWczivSXUYrYPXA+ryKlCAfPm6ukYlTqjnw+NUgHRpE FYnEk3zkGDi5EFFXroL7FckuWB1N3658e/Z1Eq8v+IVvo2lmplCtZlZ3m5c5UH73pJJs yK39/mNeEXP9FVuaasnl7vlbDpzL0C48dk0skkOstF0XgZnWLV/okOPCvLJAjwLCsj+g 0FiuL9w6zLbe0rjmJ0DCfEYtU17Fmv1Q11XeGI1NKCs+u9pEQKK8aexcG6q1PVRwaoYQ itgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696242546; x=1696847346; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Dl56URatrCxYY5LpaqZot1EYcHH+XdJPTh0UJ56itT8=; b=QURyrCGxLB1gYISK/+DyoMK+Rs65eJXXhtOcAlzgStrIm80Hq1hJygKXFiRQADfPRd H1ajkTvyG0DmxncC6zZJpe+yzKVd3ume95fmLbr/G5S2SNY2unkrroZEjSDAs23yHP/W AW0mfmkhgH3kjQXl2LVZ11t9Zq9izF6eTtroR0hMuc5mWctFNluZTXW+l23OrzZQ1U5b 1dBXKOfpewIQHraCURIIYbiHtFxS1mIdJAhrEelbCZlPMPeAjYrhjTp+VMh22lA8CCdw 2aerwlEl01C/yDkk7ppx7M/lx2BGsQwo2GG08pFSxOj8i3vX9e41nN7dXVXZ4IRXoO0F kTuQ== X-Gm-Message-State: AOJu0YwvVFxVct7RYj6D5KwIhtTW9rk9G03I41r8JB7kj/Cce/zuejJW 8B5itIcriqHLdu5W7lfJpWeB0f/D6KGiVobMNaA= X-Google-Smtp-Source: AGHT+IE+YRGFaD/revxYL0qUv9/lgroX4DRcdMaXrT+OITHqjcMyRspI3EC26f46lzs/EY64gATlSE9eOogKp3tGEqI= X-Received: by 2002:a17:906:25d:b0:9ae:6552:4af6 with SMTP id 29-20020a170906025d00b009ae65524af6mr9247680ejl.1.1696242546068; Mon, 02 Oct 2023 03:29:06 -0700 (PDT) MIME-Version: 1.0 References: <87bke2ozy8.fsf@tethera.net> <874jjm33oo.fsf@tethera.net> In-Reply-To: <874jjm33oo.fsf@tethera.net> From: David Pinto Date: Mon, 2 Oct 2023 10:28:54 +0000 Message-ID: Subject: Re: automatically changing FCC when From changes (or fill FCC only when sending) To: David Bremner Message-ID-Hash: AWP7LRI2KWOLYTEZ4WODHS3H62JVVYGS X-Message-ID-Hash: AWP7LRI2KWOLYTEZ4WODHS3H62JVVYGS X-MailFrom: carandraug@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 CC: notmuch@notmuchmail.org 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-Country: DE X-Migadu-Spam-Score: -0.05 X-Migadu-Scanner: mx2.migadu.com X-Migadu-Queue-Id: E2BFA52C65 X-Spam-Score: -0.05 X-TUID: mYd4zablzyVU On Fri, 22 Sept 2023 at 10:25, David Bremner wrote: > David Pinto writes: > > [...] > > You mention updating the "From" when the "To" changes with the > > notmuch-address-post-completion-functions hook. Could there be a hook > > for when the "From" changes which I could use to change the FCC? > > My partial-solution relies on using completion to change To. If you are > OK with that (i.e. manual editing without completion would not update > Fcc), then the same scheme could work. > > Another option that seems technically feasible, but would involve some > elisp programming, would be to write a command that re-applies the > calculation of Fcc from From that already exists, and run that manually > or perhaps opt-in to running it automatically on send. Thank you for the hints. I followed your hint and read the code for notmuch-fcc-header-setup. Then I wrote a function that updates the FCC header and I hooked it to the address-post-completion: (defun update-fcc-header (addr) "Replace FCC header appropriate for given address" (let ((subdir (cdr (assoc addr notmuch-fcc-dirs 'string-match-p)))) (when subdir (save-excursion (message-goto-fcc) (delete-region (line-beginning-position) (point)) (insert "Fcc: " subdir))))) (defun update-fcc-header-when-from-address-completion (addr) "To hook on notmuch-address-post-completion-functions" (let ((cline (thing-at-point 'line))) (when (or (string-prefix-p "From:" cline) (string-prefix-p "Resent-From:" cline)) (update-fcc-header addr)))) (setq notmuch-address-post-completion-functions '(update-fcc-header-when-from-address-completion)) It's here for anyone interested on the same functionality in the future. Do you think this is an interesting feature to be part of notmuch? If so, I could improve it and add some checks to cover for the different notmuch-fcc-dirs types of values. Best wishes David