From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Question about `message-options-set-recipient' and friends. Date: Mon, 04 Nov 2019 14:08:06 -0600 Message-ID: <87bltr8k42.fsf@red-bean.com> Reply-To: Karl Fogel Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="270191"; mail-complaints-to="usenet@blaine.gmane.org" To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 04 21:26:01 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iRivJ-00187I-8K for ged-emacs-devel@m.gmane.org; Mon, 04 Nov 2019 21:26:01 +0100 Original-Received: from localhost ([::1]:38024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRivH-0004vq-K0 for ged-emacs-devel@m.gmane.org; Mon, 04 Nov 2019 15:25:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42900) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRiug-0004vf-PB for emacs-devel@gnu.org; Mon, 04 Nov 2019 15:25:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRiuf-0001Tc-FS for emacs-devel@gnu.org; Mon, 04 Nov 2019 15:25:22 -0500 Original-Received: from mail-yw1-xc2d.google.com ([2607:f8b0:4864:20::c2d]:40936) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iRiuf-0001TR-BX for emacs-devel@gnu.org; Mon, 04 Nov 2019 15:25:21 -0500 Original-Received: by mail-yw1-xc2d.google.com with SMTP id a67so7446982ywg.7 for ; Mon, 04 Nov 2019 12:25:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:reply-to:message-id:mime-version; bh=qPnNdWO2NsY2GOdMk1cEYjNHia4x+Gj+GCHZG6Q5x1Y=; b=I1B37w+vk7/mIs7dgVPGeaF78omp+g6Xw01rtHKJwZCdSQ8MxyyF3wLPP/LrG8+jS+ +dfA+EE73+eB/gznbR+mi64VErWl99DuUHYTzcGpMY10cXF/ZsD1RUTwcBTWZu9TDn/P E78WNLRJM0qeFdQiLeGxgJZwYGGb7mRXRN493jG+pTNq1WLjgHJcajHaYwUj7dUMTnAt ZbtFIMbL0/QarkUigfFkvmkelrVZc4zIcfd0B1RTru9yklAuQaPNhb8SbcordcBEZeL5 55JSGzIruLaf7+GAEP5YJEaOoEVnF0kiSQ7ccz3Hb1jfFFXfM1nxD01KwKtIQ1qAOUrN lJ2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:reply-to:message-id :mime-version; bh=qPnNdWO2NsY2GOdMk1cEYjNHia4x+Gj+GCHZG6Q5x1Y=; b=MMY22Hst+Vr8Isa0Z4nTky90BjwTXVpPwzurQuuo6XZMx4f2a41FUnvSiAQMakc/Qp OfsWHgEc+55J/VsisY3c9qC4rEiNlhr8VTLt4vOM/YgsqEYKK3UbHDB6yJkjPWhreg1c PiZXNsbeU7OhfwIqdntoLsUERcxsrShK7/gD0Z9TUSCq87UA0pdNeuo1YiUuZjq7IWdi CWV9qmOD1HmpO+K7yRIUyWXuzLUW3caE5veVZDGMhFNIihWxYskyQm+GO7q8/EoBDc/g qkLGNP2HDj5kHYSf7zMfWhlV6hlZ+QttV3LgAZmlnIehG7BPW6XnUv7SLy3qK+x2H43i VQ4g== X-Gm-Message-State: APjAAAWf3h0Y0KTkl1lWdWcptsW16umHm7LPFO/H5V8jj0m2tBMlQZan kY65uOTHX5HRCZQZeBOy85REl9vd X-Google-Smtp-Source: APXvYqy+CNAPvtSxE0vNy8YHynPKBsoyhMBSEGCJeeOSDHE0eyyooO/qM4KknxpCQEJ3HIdbYF+OAQ== X-Received: by 2002:a81:3d85:: with SMTP id k127mr14826377ywa.346.1572899119848; Mon, 04 Nov 2019 12:25:19 -0800 (PST) Original-Received: from kwork (c-67-173-70-191.hsd1.il.comcast.net. [67.173.70.191]) by smtp.gmail.com with ESMTPSA id q124sm20025467ywq.8.2019.11.04.12.25.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2019 12:25:19 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c2d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:241787 Archived-At: While debugging a new problem I encountered with sending OpenPGP-signed replies in Gnus via message-mode, I ran into some confusing code: The function `message-options-set-recipient' in gnus/message.el is undocumented, but -- if one overlooks a little singular/plural inconsistency -- its name suggests that it sets the recipients (in `message-options'). What it actually does, though, is set *both* the sender and the recipient: (defun message-options-set-recipient () (save-restriction (message-narrow-to-headers-or-head) (message-options-set 'message-sender (mail-strip-quoted-names (message-fetch-field "from"))) (message-options-set 'message-recipients (mail-strip-quoted-names (let ((to (message-fetch-field "to")) (cc (message-fetch-field "cc")) (bcc (message-fetch-field "bcc"))) (concat (or to "") (if (and to cc) ", ") (or cc "") (if (and (or to cc) bcc) ", ") (or bcc ""))))))) I don't know this code very well, so I'm checking here before making any changes. What I'd like to do is change its name to `message-options-set-sender-and-recipients' and add a doc string. I know it's an awkward name, but I couldn't think of anything better. No functional change is intended here, obviously -- I'm just trying to make the code more comprehensible. Note that there are various places in the code that call "(message-options-set 'message-recipients SOME-VALUE)" manually. I'm not proposing to update those calls to use this function, because I don't know what the effects of also setting the sender in those places would be. One of the things I don't fully understand is exactly what `message-options' does. Here's how it is defined: (defvar message-options nil "Some saved answers when sending message.") (make-variable-buffer-local 'message-options) So is it... a cache of some sort? What's its lifetime? When can we count on information being there? Why is it better to look for a value in `message-options' instead of just doing something like `(message-fetch-field "from")' or whatever? Why are we saving answers at all when sending a message? If that variable were fully documented, I'd be able to write better documentation for the function I'm proposing to rename to `message-options-set-sender-and-recipients'. (By the way, all of the above is yak-shaving on the way to debugging the real problem I encountered, which is that suddenly when replying to GPG-signed message, such that my reply is also set to be GPG-signed, in `mml-secure-epg-sign' the value of `signer-names' in the initial `let' is set to nil because even though `sender' is set correctly to my usual sending email address and protocol is `OpenPGP', `mml-secure-signer-names' returns nil. I don't know what might have changed recently to cause this; if anyone does, please post.) Best regards, -Karl