From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: 2 nits about mailabbrev
Date: Mon, 27 Sep 2004 12:25:14 -0600 [thread overview]
Message-ID: <41585B0A.20201@yahoo.com> (raw)
In-Reply-To: loom.20040926T201738-398@post.gmane.org
John Owens wrote:
> 1) .alias accepts a syntax like the following:
>
> alias gwbush "George W. Bush <president@whitehouse.gov>"
>
> All good so far. I like this syntax; it's well-known, it's easy, pretty
> much every mailer likes it. Now, when I expand the alias
>
> (add-hook 'mail-mode-hook 'mail-abbrevs-setup)
>
> in mail mode, I get the following:
>
> To: George W. Bush <president@whitehouse.gov>
>
> Now, while that looks nice, the . after W is not in fact good syntax,
> and to make it compliant (RFC 822), it should really expand to
>
> To: "George W. Bush" <president@whitehouse.gov>
Yes, but don't those other MUAs that grok .alias also generate a
non-compliant To: header? And isn't the solution to that problem to
explicitly include the necessary quotes:
alias gwbush "\"George W. Bush\" <president@whitehouse.gov>"
> although if I just had
>
> alias gwbush "George W Bush <president@whitehouse.gov>"
>
> I think it should expand to
>
> To: George W Bush <president@whitehouse.gov>
Doesn't this code from sendmail-send-it do the right thing?
(cond ((eq mail-from-style 'angles)
(insert "From: " fullname)
(let ((fullname-start (+ (point-min) 6))
(fullname-end (point-marker)))
(goto-char fullname-start)
;; Look for a character that cannot appear unquoted
;; according to RFC 822.
(if (or (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]"
fullname-end 1)
quote-fullname)
(progn
;; Quote fullname, escaping specials.
(goto-char fullname-start)
(insert "\"")
(while (re-search-forward "[\"\\]"
fullname-end 1)
(replace-match "\\\\\\&" t))
(insert "\""))))
(insert " <" login ">\n"))
((eq mail-from-style 'parens)
(insert "From: " login " (")
(let ((fullname-start (point)))
(if quote-fullname
(insert "\""))
(insert fullname)
(if quote-fullname
(insert "\""))
(let ((fullname-end (point-marker)))
(goto-char fullname-start)
;; RFC 822 says \ and nonmatching parentheses
;; must be escaped in comments.
;; Escape every instance of ()\ ...
(while (re-search-forward "[()\\]" fullname-end 1)
(replace-match "\\\\\\&" t))
;; ... then undo escaping of matching parentheses,
;; including matching nested parentheses.
(goto-char fullname-start)
(while (re-search-forward
"\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)"
fullname-end 1)
(replace-match "\\1(\\3)" t)
(goto-char fullname-start))))
(insert ")\n"))
((null mail-from-style)
(insert "From: " login "\n"))
((eq mail-from-style 'system-default)
nil)
(t (error "Invalid value for `mail-from-style'")))
--
Kevin Rodgers
next prev parent reply other threads:[~2004-09-27 18:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-26 18:29 2 nits about mailabbrev John Owens
2004-09-27 14:53 ` Richard Stallman
2004-09-27 18:25 ` Kevin Rodgers [this message]
2004-09-27 20:40 ` John Owens
2004-09-27 23:13 ` Kevin Rodgers
2004-09-28 15:20 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41585B0A.20201@yahoo.com \
--to=ihs_4664@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.