[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about `message-options-set-recipient' and friends.

From: Karl Fogel
Subject: Question about `message-options-set-recipient' and friends.
Date: Mon, 04 Nov 2019 14:08:06 -0600

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 ()
      (message-options-set 'message-sender
                          (message-fetch-field "from")))
      (message-options-set 'message-recipients
                          (let ((to (message-fetch-field "to"))
                                (cc (message-fetch-field "cc"))
                                (bcc (message-fetch-field "bcc")))
                             (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 

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 

(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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]