]> git.eshelyaron.com Git - emacs.git/commit
Enable Better Alignment of EUDC Inline Expansion With RFC5322
authorAlexander Adolf <alexander.adolf@condition-alpha.com>
Mon, 14 Mar 2022 20:23:18 +0000 (21:23 +0100)
committerThomas Fitzsimmons <fitzsim@fitzsim.org>
Tue, 22 Mar 2022 22:15:47 +0000 (18:15 -0400)
commit8dc85d1db4564f0d9df847b7884c920a0f8d7fe9
tree2b42bf212964eeb409648e88fe7e11088f838a33
parentc8bde5b0a3c7ac6c1d71c404977f83e2b4e94092
Enable Better Alignment of EUDC Inline Expansion With RFC5322

The format of EUDC inline expansion results is formatted according to
the variable eudc-inline-expansion-format, which previously defaulted
to '("%s %s <%s>" firstname name email).

Since email address specifications need to comply with RFC 5322 in
order to be useful in messages, there was little headroom for users to
change this format anyway. Plus, if an EUDC back-end returned an empty
first and last name, the result was the email address in angle
brackets. Whilst this was standard with RFC 822, it is marked as
obsolete syntax by its successor RFC 5322. Also, the first and last
name part was never enclosed in double quotes, potentially producing
invalid address specifications, which may be rejected by a receiving
MTA.

This commit updates the variable eudc-inline-expansion-format, so that
it can, in addition to the current ("format" attributes) list, now
alternatively be set to nil, or a formatting function. In both cases
the resulting email address is formatted using the new function
eudc-rfc5322-make-address, whose results fully comply with RFC 5322.

If the value is nil (the new default value), eudc-rfc5322-make-address
will be called to produce any of the default formats

                               ADDRESS
                           FIRST <ADDRESS>
                            LAST <ADDRESS>
                         FIRST LAST <ADDRESS>

depending on whether a first and/or last name are returned by the
query, or not.

If the value is a formatting function, that will be called to allow
the user to supply content for the phrase and comment parts of the
address (cf. RFC 5322). Thus one can produce any of the formats:

                               ADDRESS
                           PHRASE <ADDRESS>
                          ADDRESS (COMMENT)
                      PHRASE <ADDRESS> (COMMENT)

This can for example be used to get "last, first <address>" instead of
the default "first last <address>".

In any case when using nil, or the formatting function, the phrase
part of the result will be enclosed in double quotes if needed, and
the comment part will be omitted if it contains characters not allowed
by RFC 5322.

When eudc-inline-expansion-format remains set to a list as previously,
the old behaviour is fully retained.
doc/misc/eudc.texi
etc/NEWS
lisp/net/eudc-vars.el
lisp/net/eudc.el