From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 27 10:43:53 2010 Received: (at submit) by debbugs.gnu.org; 27 Jul 2010 14:43:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdlNo-0006cH-RA for submit@debbugs.gnu.org; Tue, 27 Jul 2010 10:43:53 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdfFQ-0002nh-02 for submit@debbugs.gnu.org; Tue, 27 Jul 2010 04:10:48 -0400 Received: from lists.gnu.org ([199.232.76.165]:57907) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OdfFX-0007NW-Ev for submit@debbugs.gnu.org; Tue, 27 Jul 2010 04:10:55 -0400 Received: from [140.186.70.92] (port=60449 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdfFV-0007g6-OS for bug-gnu-emacs@gnu.org; Tue, 27 Jul 2010 04:10:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdfFT-0007oa-A5 for bug-gnu-emacs@gnu.org; Tue, 27 Jul 2010 04:10:53 -0400 Received: from a.mail.sonic.net ([64.142.16.245]:42754) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdfFT-0007o4-2t for bug-gnu-emacs@gnu.org; Tue, 27 Jul 2010 04:10:51 -0400 Received: from tigre (c-67-174-242-24.hsd1.ca.comcast.net [67.174.242.24]) (authenticated bits=0) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id o6R8Ab3I021387; Tue, 27 Jul 2010 01:10:45 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19534.38013.458365.325249@ixian.com> Date: Tue, 27 Jul 2010 01:10:37 -0700 To: bug-gnu-emacs@gnu.org Subject: possible bug in fill-paragraph X-Mailer: VM 7.19 under Emacs 22.2.1 From: Eric De Mund X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 27 Jul 2010 10:43:50 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eric De Mund 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: -5.3 (-----) Hello, Here's a possible bug in fill-paragraph. In my twenty years of using Emacs (and fill-paragraph), I've never come across something like this. In addition to observing this bug with: In GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2008-11-09 on raven, modified by Debian running under: Debian 5.0.5 Lenny , I've reproduced it with: GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on G41R2F1 running under: Windows XP Professional Build 2600.xpsp_sp3_gdr.100216-1514 (Service Pack 3) Here are the gory details: --------CUT HERE----BEGIN SECTION 1 OF 2-------- 0. Invoke Emacs with "emacs -nw -q" 1. Start with this 3-line paragraph: A former executive testified that David H. Brooks misused company funds to buy a belt buckle encrusted with rubies, pornographic videos for his son and prostitutes for his workers. 2. Invoke << C-u 20 C-x f >> with cursor positioned on first word "A". 3. Invoke << M-1 M-q >>. 4. Observe paragraph reformatted to this, incorrectly: A former executive testified that David H. Brooks misused company funds to buy a belt buckle encrusted with rubies, pornographic videos for his son and prostitutes for his workers. i.e. with the 6th line ("encrusted with") taking up 21 columns rather than 20 columns. --------CUT HERE----BEGIN SECTION 2 OF 2-------- In GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2008-11-09 on raven, modified by Debian configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:\ /etc/emacs:/usr/local/share/emacs/22.2/site-lisp:\ /usr/local/share/emacs/site-lisp:/usr/share/emacs/22.2/site-lisp:\ /usr/share/emacs/site-lisp:/usr/share/emacs/22.2/leim' '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 locale-coding-system: utf-8 default-enable-multibyte-characters: t Major mode: Fundamental Minor modes in effect: encoded-kbd-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t Recent input: ESC x r e p o r t - e m a c s - b u g RET Recent messages: Loading debian-ispell... Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done Loading debian-ispell...done Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Loading emacsbug... /usr/bin/mail is not an executable. Setting mail-interactive to t. Loading regexp-opt...done Loading emacsbug...done --------CUT HERE----END SECTION 2 OF 2-------- If you need more information, please don't hesitate to ask. Regards, Eric -- Eric De Mund ead-gnu-emacs@ixian.com From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 29 17:04:13 2010 Received: (at 6738) by debbugs.gnu.org; 29 Jul 2010 21:04:13 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeaGy-0006le-Mq for submit@debbugs.gnu.org; Thu, 29 Jul 2010 17:04:13 -0400 Received: from mailout-de.gmx.net ([213.165.64.23] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OeaGw-0006lY-Ur for 6738@debbugs.gnu.org; Thu, 29 Jul 2010 17:04:12 -0400 Received: (qmail invoked by alias); 29 Jul 2010 21:04:23 -0000 Received: from i59F57067.versanet.de (EHLO escher.home) [89.245.112.103] by mail.gmx.net (mp029) with SMTP; 29 Jul 2010 23:04:23 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1/Z918l4n/Z66/Vs7bhYmLN1wcO21iasG4+jIF14m 0bWrymZ71CD0kh Received: by escher.home (Postfix, from userid 1000) id 8E44A103D9; Thu, 29 Jul 2010 23:04:22 +0200 (CEST) From: Stephen Berman To: Eric De Mund Subject: Re: bug#6738: possible bug in fill-paragraph References: <19534.38013.458365.325249@ixian.com> Date: Thu, 29 Jul 2010 23:04:22 +0200 In-Reply-To: <19534.38013.458365.325249@ixian.com> (Eric De Mund's message of "Tue, 27 Jul 2010 01:10:37 -0700") Message-ID: <871vamgfu1.fsf@escher.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 6738 Cc: 6738@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -3.0 (---) On Tue, 27 Jul 2010 01:10:37 -0700 Eric De Mund wrote: > 0. Invoke Emacs with "emacs -nw -q" > > 1. Start with this 3-line paragraph: > > A former executive testified that David H. Brooks misused company > funds to buy a belt buckle encrusted with rubies, pornographic videos > for his son and prostitutes for his workers. > > 2. Invoke << C-u 20 C-x f >> with cursor positioned on first word "A". > > 3. Invoke << M-1 M-q >>. > > 4. Observe paragraph reformatted to this, incorrectly: > > A former executive > testified that David > H. Brooks misused > company funds to buy > a belt buckle > encrusted with > rubies, pornographic > videos for his son > and prostitutes for > his workers. > > i.e. with the 6th line ("encrusted with") taking up 21 columns > rather than 20 columns. It seems that the algorithm in justify-current-line doesn't work so well for a two-word line: it correctly calculates the number of additional space characters needed (ncols) but expects to fractionally distribute them, as it does in the other lines, so it adds more space, in this case wrongly. In such a situation, it suffices to just stick with ncols, as in the following patch (but I haven't tested this in other cases, so maybe it isn't the best fix). Steve Berman ***/bzr/emacs/trunk/lisp/textmodes/fill.el 2010-05-29 13:10:05.000000000 +0200 ---/bzr/emacs/quickfixes/lisp/textmodes/fill.el 2010-07-29 22:48:58.000000000 +0200 *************** *** 1296,1302 **** (while (> count 0) (skip-chars-forward " ") (insert-and-inherit ! (make-string (/ curr-fracspace nspaces) ?\s)) (search-forward " " nil t) (setq count (1- count) curr-fracspace --- 1296,1303 ---- (while (> count 0) (skip-chars-forward " ") (insert-and-inherit ! (make-string ! (min ncols (/ curr-fracspace nspaces)) ?\s)) (search-forward " " nil t) (setq count (1- count) curr-fracspace From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 02 11:55:18 2010 Received: (at 6738-done) by debbugs.gnu.org; 2 Aug 2010 15:55:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfxMD-0006BH-EV for submit@debbugs.gnu.org; Mon, 02 Aug 2010 11:55:18 -0400 Received: from impaqm2.telefonica.net ([213.4.138.2]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfsEi-0003Cx-3n for 6738-done@debbugs.gnu.org; Mon, 02 Aug 2010 06:27:13 -0400 Received: from IMPmailhost5.adm.correo ([10.20.102.126]) by IMPaqm2.telefonica.net with bizsmtp id pJRz1e00L2jdgqJ3MNTZqe; Mon, 02 Aug 2010 12:27:33 +0200 Received: from ceviche.home ([83.61.38.247]) by IMPmailhost5.adm.correo with BIZ IMP id pNTY1e0045KwfZf1lNTY7s; Mon, 02 Aug 2010 12:27:33 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Received: by ceviche.home (Postfix, from userid 20848) id E1B6366125; Mon, 2 Aug 2010 12:27:31 +0200 (CEST) From: Stefan Monnier To: Stephen Berman Subject: Re: bug#6738: possible bug in fill-paragraph Message-ID: References: <19534.38013.458365.325249@ixian.com> <871vamgfu1.fsf@escher.home> Date: Mon, 02 Aug 2010 12:27:31 +0200 In-Reply-To: <871vamgfu1.fsf@escher.home> (Stephen Berman's message of "Thu, 29 Jul 2010 23:04:22 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 6738-done X-Mailman-Approved-At: Mon, 02 Aug 2010 11:55:16 -0400 Cc: Eric De Mund X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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 (-) > It seems that the algorithm in justify-current-line doesn't work so well > for a two-word line: it correctly calculates the number of additional > space characters needed (ncols) but expects to fractionally distribute > them, as it does in the other lines, so it adds more space, in this case > wrongly. In such a situation, it suffices to just stick with ncols, as > in the following patch (but I haven't tested this in other cases, so > maybe it isn't the best fix). I've changed the curr-fracspace calculation instead. Not sure why it was doing a +1 on nspaces, and removing it fixes this problem (I'm not sure it doesn't introduce another one, but at least my tests lead me to think that's not the case). Stefan From unknown Sat Jun 14 19:16:00 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 31 Aug 2010 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator