From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.devel Subject: Re: beginning-of-defun-comments bug [was: Re: 26.0.90: mark-defun problem in c-mode] Date: Wed, 03 Jan 2018 05:51:35 +0100 Message-ID: <87incjh7ef.fsf@mbork.pl> References: <834lo8fqyi.fsf@gnu.org> <20171230103432.GB10623@ACM> <20171230120136.GD10623@ACM> <83shbse5rs.fsf@gnu.org> <20171230130529.GE10623@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1514955040 19027 195.159.176.226 (3 Jan 2018 04:50:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 3 Jan 2018 04:50:40 +0000 (UTC) User-Agent: mu4e 0.9.19; emacs 27.0.50 Cc: Eli Zaretskii , emacs-devel@gnu.org, npostavs@gmail.com, ccsmile2008@outlook.com To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 03 05:50:35 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWb0b-0004TG-Ki for ged-emacs-devel@m.gmane.org; Wed, 03 Jan 2018 05:50:33 +0100 Original-Received: from localhost ([::1]:39368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWb2Z-0002kf-2h for ged-emacs-devel@m.gmane.org; Tue, 02 Jan 2018 23:52:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWb1u-0002jc-14 for emacs-devel@gnu.org; Tue, 02 Jan 2018 23:51:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWb1t-0006Dc-1Y for emacs-devel@gnu.org; Tue, 02 Jan 2018 23:51:54 -0500 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:49493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWb1p-0006Aa-AO; Tue, 02 Jan 2018 23:51:49 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 8157DE6BFB; Wed, 3 Jan 2018 05:51:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FtiywLP1RlOm; Wed, 3 Jan 2018 05:51:40 +0100 (CET) Original-Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 5C9A0E6538; Wed, 3 Jan 2018 05:51:39 +0100 (CET) In-reply-to: <20171230130529.GE10623@ACM> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.110.48.8 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:221547 Archived-At: On 2017-12-30, at 14:05, Alan Mackenzie wrote: > Hello, Eli. > > On Sat, Dec 30, 2017 at 14:53:27 +0200, Eli Zaretskii wrote: >> > Date: Sat, 30 Dec 2017 12:01:36 +0000 >> > Cc: emacs-devel@gnu.org, zhang cc , >> > Noam Postavsky >> > From: Alan Mackenzie > >> > > I see the error, with point anywhere in the body of the second function. >> > > Critical seems to be there being no blank line between the functions. > >> > > I think there's a bug in beginning-of-defun-comments, which I'm in the >> > > middle of edebugging. It moves point into the first function. > >> > beginning-of-defun-comments has a bug. On doing M-x >> > beginning-of-defun-comments from the inside of a function, when there's >> > no blank lines between it and the previous function, point ends up >> > inside that previous function, not at the comments which may separate >> > them. > >> > Perhaps this bug should be fixed before the next Emacs-26 pretest. > >> How old is this problem? It looks like it's new in Emacs 26? If so, >> we should try fixing it on the release branch. > > beginning-of-defun-comments came into existence on 2017-03-31, so this > problem is definitely new in Emacs 26. Yep, it was committed by me. Sorry for the mess. And I thought I had tested that thoroughly... > I've diagnosed the bug. At one place, it is necessary to scan a line of > text from BOL to detect any non-comment/non-space character. The > current code tries to do this by using parse-partial-sexp with the > fourth argument STOPBEFORE non-nil. > > This STOPBEFORE causes the scanning to stop at any character which > begins a sexp. A closing brace doesn't fit into this category. The > scan therefore reaches EOL, and the code therefore falsely assumes there > are no non-syntactic-ws characters on that line. > > I'm sure I can fix this today. Any success? If not, can I help in any way? (At the very least, I could write some more tests to cover this case.) Best, -- Marcin Borkowski