From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.devel Subject: Re: 2 nits about mailabbrev Date: Mon, 27 Sep 2004 12:25:14 -0600 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <41585B0A.20201@yahoo.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1096309561 4711 80.91.229.6 (27 Sep 2004 18:26:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 27 Sep 2004 18:26:01 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 27 20:25:49 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CC0C4-00017p-00 for ; Mon, 27 Sep 2004 20:25:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CC0IJ-00074K-Lg for ged-emacs-devel@m.gmane.org; Mon, 27 Sep 2004 14:32:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CC0ID-00074E-17 for emacs-devel@gnu.org; Mon, 27 Sep 2004 14:32:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CC0IB-00072l-GS for emacs-devel@gnu.org; Mon, 27 Sep 2004 14:32:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CC0IB-00072i-ED for emacs-devel@gnu.org; Mon, 27 Sep 2004 14:32:07 -0400 Original-Received: from [80.91.229.2] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CC0BZ-0008RA-1s for emacs-devel@gnu.org; Mon, 27 Sep 2004 14:25:17 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1CC0BY-0002FV-00 for ; Mon, 27 Sep 2004 20:25:16 +0200 Original-Received: from 170.207.1.200 ([170.207.1.200]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Sep 2004 20:25:16 +0200 Original-Received: from ihs_4664 by 170.207.1.200 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Sep 2004 20:25:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 88 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 170.207.1.200 User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 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 Xref: main.gmane.org gmane.emacs.devel:27622 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27622 John Owens wrote: > 1) .alias accepts a syntax like the following: > > alias gwbush "George W. Bush " > > 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 > > 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" 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\" " > although if I just had > > alias gwbush "George W Bush " > > I think it should expand to > > To: George W Bush 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