From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.bugs Subject: bug#12439: 24.2.50; mail-abbrev fills long aliasee uglily Date: Fri, 14 Sep 2012 17:53:15 +0900 Organization: Emacsen advocacy group Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1347612860 21832 80.91.229.3 (14 Sep 2012 08:54:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Sep 2012 08:54:20 +0000 (UTC) To: 12439@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 14 10:54:24 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TCRfL-0003yd-UR for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Sep 2012 10:54:24 +0200 Original-Received: from localhost ([::1]:47174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRfI-0000Lc-7r for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Sep 2012 04:54:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRfB-0008V8-Jx for bug-gnu-emacs@gnu.org; Fri, 14 Sep 2012 04:54:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCRf5-00032n-SU for bug-gnu-emacs@gnu.org; Fri, 14 Sep 2012 04:54:13 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRf5-00032i-P3 for bug-gnu-emacs@gnu.org; Fri, 14 Sep 2012 04:54:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TCRfz-000236-LR for bug-gnu-emacs@gnu.org; Fri, 14 Sep 2012 04:55:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Katsumi Yamaoka Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Sep 2012 08:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12439 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13476128797841 (code B ref -1); Fri, 14 Sep 2012 08:55:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Sep 2012 08:54:39 +0000 Original-Received: from localhost ([127.0.0.1]:32999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TCRfb-00022P-3G for submit@debbugs.gnu.org; Fri, 14 Sep 2012 04:54:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39939) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TCRfX-00022G-Il for submit@debbugs.gnu.org; Fri, 14 Sep 2012 04:54:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCReX-0002yk-AJ for submit@debbugs.gnu.org; Fri, 14 Sep 2012 04:53:39 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:55312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCReX-0002ye-77 for submit@debbugs.gnu.org; Fri, 14 Sep 2012 04:53:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCReR-0007yw-94 for bug-gnu-emacs@gnu.org; Fri, 14 Sep 2012 04:53:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCReM-0002mj-AP for bug-gnu-emacs@gnu.org; Fri, 14 Sep 2012 04:53:27 -0400 Original-Received: from orlando.hostforweb.net ([216.246.45.90]:55985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCReM-0002mc-5W for bug-gnu-emacs@gnu.org; Fri, 14 Sep 2012 04:53:22 -0400 Original-Received: from localhost ([127.0.0.1]:32868) by orlando.hostforweb.net with smtp (Exim 4.77) (envelope-from ) id 1TCReI-0006dO-HB; Fri, 14 Sep 2012 03:53:18 -0500 X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.130006 (=?UTF-8?Q?=E7=9C=9F?= Gnus v0.6) Emacs/24.2.50 (i686-pc-cygwin) Cancel-Lock: sha1:1qLBdqi4FG+4z30xNesh/vkIPeE= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-detected-operating-system: by eggs.gnu.org: Linux 2.6? (barebone, rare!) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64268 Archived-At: --=-=-= Hi, By default message.el uses mail-abbrev to expand mail aliases in headers in a draft. If an aliasee is longer than fill-column, it will be expanded like the following: To: foo1@bar.baz, foo2@bar.baz, foo3@bar.baz, foo4@bar.baz, foo5@bar.baz, foo6@bar.baz, foo7@bar.baz, foo8@bar.baz To reproduce this, try the "foo" alias specified as follows: (define-mail-abbrev "foo" "foo1@bar.baz, foo2@bar.baz, foo3@bar.baz, foo4@bar.baz,\ foo5@bar.baz, foo6@bar.baz, foo7@bar.baz, foo8@bar.baz") The point is that the latter half addresses in an aliasee are put line by line. Moreover, I think a SPC is enough for LWSP preceding to the latter half (message.el uses TAB in some fill function, though), rather than the one indent-relative generates. A patch I tried is attached below. --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- mailabbrev.el~ 2012-05-06 21:58:55.506179000 +0000 +++ mailabbrev.el 2012-09-14 08:38:38.323389500 +0000 @@ -391,35 +391,24 @@ (defun mail-abbrev-expand-hook () "For use as the fourth arg to `define-abbrev'. After expanding a mail-abbrev, if Auto Fill mode is on and we're past the -fill-column, break the line at the previous comma, and indent the next line." - ;; Disable abbrev mode to avoid recursion in indent-relative expanding - ;; part of the abbrev expansion as an abbrev itself. - (let ((abbrev-mode nil)) - (save-excursion - (let ((p (point)) - bol comma fp) - (beginning-of-line) - (setq bol (point)) - (goto-char p) - (while (and auto-fill-function - (>= (current-column) fill-column) - (search-backward "," bol t)) - (setq comma (point)) - (forward-char 1) ; Now we are just past the comma. - (insert "\n") - (delete-horizontal-space) - (setq p (point)) - (indent-relative) - (setq fp (buffer-substring p (point))) - ;; Go to the end of the new line. - (end-of-line) - (if (> (current-column) fill-column) - ;; It's still too long; do normal auto-fill. - (let ((fill-prefix (or fp "\t"))) - (do-auto-fill))) - ;; Resume the search. - (goto-char comma) - ))))) +fill-column, break the line at the previous comma, and indent the next line +with a space." + (when auto-fill-function + (let (p) + (save-excursion + (while (>= (current-column) fill-column) + (while (and (search-backward "," (point-at-bol) 'move) + (>= (current-column) (1- fill-column)) + (setq p (point)))) + (when (or (not (bolp)) + (and p (goto-char p))) + (setq p nil) + (forward-char 1) + (insert "\n") + (when (looking-at "[\t ]+") + (delete-region (point) (match-end 0))) + (insert " ") + (end-of-line))))))) ;;; Syntax tables and abbrev-expansion --=-=-=--