From unknown Sat Jun 14 03:56:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12439: 24.2.50; mail-abbrev fills long aliasee uglily 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: To: 12439@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13476128797841 (code B ref -1); Fri, 14 Sep 2012 08:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Sep 2012 08:54:39 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_TVD_MIME_NO_HEADERS autolearn=unavailable version=3.3.2 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 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 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 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 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 Date: Fri, 14 Sep 2012 17:53:15 +0900 Message-ID: From: Katsumi Yamaoka Organization: Emacsen advocacy group 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= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) --=-=-= 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 --=-=-=-- From unknown Sat Jun 14 03:56:20 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Katsumi Yamaoka Subject: bug#12439: closed (Re: bug#12439: 24.2.50; mail-abbrev fills long aliasee uglily) Message-ID: References: X-Gnu-PR-Message: they-closed 12439 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 12439@debbugs.gnu.org Date: Sun, 16 Sep 2012 23:18:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1347837482-16744-1" This is a multi-part message in MIME format... ------------=_1347837482-16744-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #12439: 24.2.50; mail-abbrev fills long aliasee uglily which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 12439@debbugs.gnu.org. --=20 12439: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D12439 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1347837482-16744-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 12439-done) by debbugs.gnu.org; 16 Sep 2012 23:17:43 +0000 Received: from localhost ([127.0.0.1]:37637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDO5u-0004Kt-QM for submit@debbugs.gnu.org; Sun, 16 Sep 2012 19:17:43 -0400 Received: from mail-halifax.hostforweb.net ([205.234.137.17]:36007 helo=halifax.hostforweb.net) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TDO5s-0004Kc-2U for 12439-done@debbugs.gnu.org; Sun, 16 Sep 2012 19:17:41 -0400 Received: from softbank219034144017.bbtec.net ([219.34.144.17]:40989 helo=) by halifax.hostforweb.net with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77) (envelope-from ) id 1TDO4h-0002db-Ci; Sun, 16 Sep 2012 18:16:27 -0500 From: Katsumi Yamaoka To: 12439-done@debbugs.gnu.org Subject: Re: bug#12439: 24.2.50; mail-abbrev fills long aliasee uglily References: References: 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&( Date: Mon, 17 Sep 2012 08:16:21 +0900 Message-ID: User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) Cancel-Lock: sha1:qtiXwBlBhP+iTraJotoeomN7j1g= MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - halifax.hostforweb.net X-AntiAbuse: Original Domain - debbugs.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-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12439-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Katsumi Yamaoka wrote: > 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. I've installed my patch to the trunk. ------------=_1347837482-16744-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 Sep 2012 08:54:39 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_TVD_MIME_NO_HEADERS autolearn=unavailable version=3.3.2 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 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 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 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 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 Date: Fri, 14 Sep 2012 17:53:15 +0900 Message-ID: From: Katsumi Yamaoka To: bug-gnu-emacs@gnu.org Subject: 24.2.50; mail-abbrev fills long aliasee uglily Organization: Emacsen advocacy group 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 (=?iso-2022-jp?B?GyRCPz8bKEI=?= Gnus v0.6) Emacs/24.2.50 (i686-pc-cygwin) Cancel-Lock: sha1:1qLBdqi4FG+4z30xNesh/vkIPeE= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) --=-=-= 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 --=-=-=-- ------------=_1347837482-16744-1--