unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 2 nits about mailabbrev
@ 2004-09-26 18:29 John Owens
  2004-09-27 14:53 ` Richard Stallman
  2004-09-27 18:25 ` Kevin Rodgers
  0 siblings, 2 replies; 6+ messages in thread
From: John Owens @ 2004-09-26 18:29 UTC (permalink / raw)


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>

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>

2) Again using mailabbrev, expansion happens after the @
character is typed, so if I have

alias george "GW Bush <president@whitehouse.gov>"

and then I want to mail my friend george@gnu.org, I type

To: george@

which immediately expands to

To: GW Bush <president@whitehouse.gov>@

which does not seem to me to be useful. I can't think of a 
circumstance where I'd want expansion when the @ character 
is typed. Commas, whitespace, that makes sense. But not @.

Using fairly recent (~1 week ago) build of CVS emacs 21.3.50.1
on OS X 10.3.5.

JDO

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2 nits about mailabbrev
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2004-09-27 14:53 UTC (permalink / raw)
  Cc: emacs-devel

I agree these changes are called for.
Would someone like to work on fixes for these bugs?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2 nits about mailabbrev
  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
  2004-09-27 20:40   ` John Owens
  1 sibling, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2004-09-27 18:25 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2 nits about mailabbrev
  2004-09-27 18:25 ` Kevin Rodgers
@ 2004-09-27 20:40   ` John Owens
  2004-09-27 23:13     ` Kevin Rodgers
  2004-09-28 15:20     ` Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: John Owens @ 2004-09-27 20:40 UTC (permalink / raw)


Kevin Rodgers <ihs_4664 <at> yahoo.com> writes: 
> John Owens wrote:

>  > 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 <at> 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 <at> whitehouse.gov>"

The other MUAs probably do it wrong. However, in my informal experiments
with different MUAs some time ago (I think I tried VM, /bin/mail, and
Wanderlust), the most widely supported format among MUAs was 

alias gwbush "George W. Bush <president@whitehouse.gov>"

Other formats had errors in different MUAs. I do encourage others to
try different MUAs to check. But my conclusion at the time was 
certainly that I should leave my .alias in the format above, since it
was the most widely supported.

The issue at hand, I think, is "what should mailabbrev do?" It seems to
me that no matter what other MUAs might do, mailabbrev should take the
common .alias format as an input and output a RFC-822 compliant string
if it can. I think that's better than the current behavior. 

> Doesn't this code from sendmail-send-it do the right thing?
> (snipped)

It may, although I'm using mailabbrev without sendmail-send-it, so it
doesn't help me. I think putting it in both places would not hurt; some
people use mailabbrev without sendmail-send-it, some people use 
sendmail-send-it without mailabbrev, and they could certainly be
mutually compatible. It would be possible to control mailabbrev's
munging with a variable and set it as nil by default, but since my 
proposed change doesn't hurt anything and only makes it more correct
(I hope), I don't think this is necessary.

JDO

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2 nits about mailabbrev
  2004-09-27 20:40   ` John Owens
@ 2004-09-27 23:13     ` Kevin Rodgers
  2004-09-28 15:20     ` Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2004-09-27 23:13 UTC (permalink / raw)


John Owens wrote:
 > Kevin Rodgers <ihs_4664 <at> yahoo.com> writes:
 >>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 <at> whitehouse.gov>"
 >
 > The other MUAs probably do it wrong. However, in my informal experiments
 > with different MUAs some time ago (I think I tried VM, /bin/mail, and
 > Wanderlust), the most widely supported format among MUAs was
 > alias gwbush "George W. Bush <president@whitehouse.gov>"
 >
 > Other formats had errors in different MUAs. I do encourage others to
 > try different MUAs to check. But my conclusion at the time was
 > certainly that I should leave my .alias in the format above, since it
 > was the most widely supported.

FWIW, I use VM + smtpmail.el + mailabbrev.el

 > The issue at hand, I think, is "what should mailabbrev do?" It seems to
 > me that no matter what other MUAs might do, mailabbrev should take the
 > common .alias format as an input and output a RFC-822 compliant string
 > if it can. I think that's better than the current behavior.

Agreed.

 >>Doesn't this code from sendmail-send-it do the right thing?
 >>(snipped)
 >>
 >
 > It may, although I'm using mailabbrev without sendmail-send-it, so it
 > doesn't help me. I think putting it in both places would not hurt; some
 > people use mailabbrev without sendmail-send-it, some people use
 > sendmail-send-it without mailabbrev, and they could certainly be
 > mutually compatible. It would be possible to control mailabbrev's
 > munging with a variable and set it as nil by default, but since my
 > proposed change doesn't hurt anything and only makes it more correct
 > (I hope), I don't think this is necessary.

If we change mailabbrev.el, then mailalias.el should be kept in sync.

If we change sendmail.el, then smtpmail.el, feedmail.el, and mailpost.el
should be kept in sync.  I think that's the proper place to fix the
problem, since it's not strictly an alias problem: the same address
could be entered manually, and there are other encoding issues with
addresses that Emacs should handle (e.g. non-ASCII characters).

It'd be nice to eliminate some of the code duplication in those files.
If the snippet from sendmail-send-it works, it could just be
encapsulated as a new function (send-mail-encode-rfc822-recipient or
something) that the other *mail.el files could call as well.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2 nits about mailabbrev
  2004-09-27 20:40   ` John Owens
  2004-09-27 23:13     ` Kevin Rodgers
@ 2004-09-28 15:20     ` Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2004-09-28 15:20 UTC (permalink / raw)
  Cc: emacs-devel

    The issue at hand, I think, is "what should mailabbrev do?" It seems to
    me that no matter what other MUAs might do, mailabbrev should take the
    common .alias format as an input and output a RFC-822 compliant string
    if it can. I think that's better than the current behavior. 

I think you are right.

Of course, we should make sure that if users do what gets good
results in other MUAs, it gets good results in Emacs too.
But there is no conflict between that and what you propose.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-09-28 15:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2004-09-27 20:40   ` John Owens
2004-09-27 23:13     ` Kevin Rodgers
2004-09-28 15:20     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).