From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: c-indent-line-or-region with 500 char Date: Mon, 28 Jan 2019 11:11:20 +0000 Message-ID: <20190128111120.GA16059@ACM> References: <20181208135351.GA17410@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="57855"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org To: Yasushi SHOJI Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 28 12:19:05 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1go4wR-000Enr-Bm for ged-emacs-devel@m.gmane.org; Mon, 28 Jan 2019 12:19:03 +0100 Original-Received: from localhost ([127.0.0.1]:58114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go4wQ-0004Jb-9R for ged-emacs-devel@m.gmane.org; Mon, 28 Jan 2019 06:19:02 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go4pm-00083J-8O for emacs-devel@gnu.org; Mon, 28 Jan 2019 06:12:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1go4pl-0006QZ-Fq for emacs-devel@gnu.org; Mon, 28 Jan 2019 06:12:10 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:41372 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1go4pl-0006Ot-96 for emacs-devel@gnu.org; Mon, 28 Jan 2019 06:12:09 -0500 Original-Received: (qmail 44595 invoked by uid 3782); 28 Jan 2019 11:12:06 -0000 Original-Received: from acm.muc.de (p4FE15E39.dip0.t-ipconnect.de [79.225.94.57]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 28 Jan 2019 12:12:05 +0100 Original-Received: (qmail 16101 invoked by uid 1000); 28 Jan 2019 11:11:20 -0000 Content-Disposition: inline In-Reply-To: <20181208135351.GA17410@ACM> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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 Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:232759 Archived-At: Hello, Yashi. Unfortunately, the patch I suggested in my last post was faulty. I've now committed a better patch to Emacs master, which should have fixed the problem. All the best! -- Alan Mackenzie (Nuremberg, Germany). On Sat, Dec 08, 2018 at 13:53:51 +0000, Alan Mackenzie wrote: > Hello, Yashi. > On Mon, Nov 26, 2018 at 22:19:15 +0900, Yasushi SHOJI wrote: > > Hello, > > I just found this odd behavior on my Emacs and I'd like to ask how to > > fix it. I'm attaching a.c with 500 chars in. Go to the very bottom of > > the file and hitting the tab will move the cursors to the right. hitting the > > tab key again moves it again. It just keeps going. > > If you delete some char from the file, it stop behaving. > > I can reproduce this with the following Emacs with `-q`. > > - Debian Sid's Emacs 1:25.2+1-11 > > - The current tip of emacs-26 branch (ea624626) > > Does anyone see the behavior? > Yes, this was one of these bugs which was fairly easy to diagnose, but > difficult to decide how to fix. Thanks for taking the trouble to report > this. > Your file is actually 502 bytes long. At some place in CC Mode, there > was a call to (c-beginning-of-statement-1 ...) with a search limit of > 500 bytes. This just failed to reach the # of the #define at the > beginning of the buffer, hence mis-analysed the text, leading to the > strange behaviour. > When a random byte is removed, this 500 limit was just big enough to > reach that # at the beginning of the buffer, hence analysed it > correctly, and the key worked properly. > The fix in the patch below amends c-beginning-of-statement-1 to detect > hitting the limit. It should apply cleanly to the emacs-26 branch. > Could you please try out this patch (to > emacs/lisp/progmodes/cc-engine.el), byte compile cc-engine.el, try it > out on your real code, and confirm to me that it fixes the bug, or tell > me what's still not working. If you want any help applying the patch or > byte compiling the file, feel free to send me private email. > Thanks again for the report! [ .... ]