From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#3688: Also need (auto-fill-mode nil) to trigger this bug Date: Fri, 26 Jun 2009 21:14:31 +0000 Message-ID: <20090626211431.GE4685__13383.885639678$1246052270$gmane$org@muc.de> References: <200906261356.48352.kees.bakker@altium.nl> Reply-To: Alan Mackenzie , 3688@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1246052270 12073 80.91.229.12 (26 Jun 2009 21:37:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Jun 2009 21:37:50 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org To: Kees Bakker , 3688@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 26 23:37:42 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MKJ75-00023R-6G for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Jun 2009 23:37:39 +0200 Original-Received: from localhost ([127.0.0.1]:52015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MKJ74-0000xz-9m for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Jun 2009 17:37:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MKJ6y-0000vd-Bb for bug-gnu-emacs@gnu.org; Fri, 26 Jun 2009 17:37:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MKJ6t-0000nM-Pm for bug-gnu-emacs@gnu.org; Fri, 26 Jun 2009 17:37:31 -0400 Original-Received: from [199.232.76.173] (port=53534 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MKJ6t-0000my-Kb for bug-gnu-emacs@gnu.org; Fri, 26 Jun 2009 17:37:27 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:42057) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MKJ6t-0005LL-20 for bug-gnu-emacs@gnu.org; Fri, 26 Jun 2009 17:37:27 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n5QLbN0I005963; Fri, 26 Jun 2009 14:37:23 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n5QLK4UQ002943; Fri, 26 Jun 2009 14:20:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Alan Mackenzie Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 26 Jun 2009 21:20:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 3688 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 3688-submit@emacsbugs.donarmstrong.com id=B3688.12460507791941 (code B ref 3688); Fri, 26 Jun 2009 21:20:04 +0000 Original-Received: (at 3688) by emacsbugs.donarmstrong.com; 26 Jun 2009 21:12:59 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail.muc.de (qmailr@colin.muc.de [193.149.48.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n5QLCrMt001930 for <3688@emacsbugs.donarmstrong.com>; Fri, 26 Jun 2009 14:12:54 -0700 Original-Received: (qmail 27315 invoked by uid 3782); 26 Jun 2009 21:12:52 -0000 Original-Received: from acm.muc.de (pD9E51439.dip.t-dialin.net [217.229.20.57]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Fri, 26 Jun 2009 23:12:49 +0200 Original-Received: (qmail 21344 invoked by uid 1000); 26 Jun 2009 21:14:31 -0000 Content-Disposition: inline In-Reply-To: <200906261356.48352.kees.bakker@altium.nl> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Fri, 26 Jun 2009 17:37:31 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:28998 Archived-At: Hi, Kees! On Fri, Jun 26, 2009 at 01:56:48PM +0200, Kees Bakker wrote: > Hi, > In my report I forgot to run emacs with -Q, but the problem is still > present with -Q. But here is extra information to reproduce the error. > After entering the suggested C text (and emacs is in a basic C mode) > you have to evaluate the following before the error can be reproduced. > (auto-fill-mode nil) > In the status bar it shows "*C/l Abbrev Fill)". In the buffer you'll > have the following. > /*type a space here=> > /* 3 tabs following after this=> */ > (Notice that there are 3 TABs before the closing C comment.) If you > type a space on the first comment line, you'll see that it jumps back > 21 positions. (The 21 appears to be equal to NumOfTabs * (8-1)). Yes, that's exactly where the 21 comes from. :-) > If you evaluate this again, the problem goes away. > (auto-fill-mode nil) > Now, the "Fill" flag is gone from the status bar. The mechanism for the bug is thus: when doing filling, c-mask-paragraph temporarily replaces the whitespace before "*/" with a string of "x"s, so that Emacs's low level filling routine can't put "*/" on a line of its own. At the end of the routine, the calculation to restore point does a spurious correction to correct for an imagined difference between the size of the WS (24 columns) and the number of bytes (3 tab characters). Removing this "uncorrection" fixes things. Please test out the patch below. Yidong and Stefan: would it be OK to install this patch for Emacs 23? The original coding error was my own, made on 2005-08-18 in version 5.314 of cc-cmds.el at SourceForge (http://cc-mode.cvs.sourceforge.net/viewvc/cc-mode/cc-mode/cc-cmds.el). 2009-06-26 Alan Mackenzie * progmodes/cc-cmds.el (c-mask-paragraph): Remove a spurious correction between the visible width of TABs and their number of bytes. Index: cc-cmds.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-cmds.el,v retrieving revision 1.82 diff -c -r1.82 cc-cmds.el *** cc-cmds.el 13 Feb 2009 14:54:27 -0000 1.82 --- cc-cmds.el 26 Jun 2009 20:54:39 -0000 *************** *** 4202,4209 **** (forward-char (- hang-ender-stuck)) (if (or fill-paragraph (not auto-fill-spaces)) (insert-char ?\ hang-ender-stuck t) ! (insert auto-fill-spaces) ! (setq here (- here (- hang-ender-stuck (length auto-fill-spaces))))) (delete-char hang-ender-stuck) (goto-char here)) (set-marker tmp-post nil)) --- 4202,4208 ---- (forward-char (- hang-ender-stuck)) (if (or fill-paragraph (not auto-fill-spaces)) (insert-char ?\ hang-ender-stuck t) ! (insert auto-fill-spaces)) (delete-char hang-ender-stuck) (goto-char here)) (set-marker tmp-post nil)) > Kind regards, > Kees Bakker -- Alan Mackenzie (Nuremberg, Germany).