From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73206: 28.2; xml comment with blank lines to do not indent correctly, nxml-mode.el Date: Sat, 28 Sep 2024 11:45:46 +0300 Message-ID: <86v7yg6u9x.fsf@gnu.org> References: <87h6akknhu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-7 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38344"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73206@debbugs.gnu.org, rpluim@gmail.com To: John Ciolfi , Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 28 10:46:51 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1suT6I-0009p9-JN for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Sep 2024 10:46:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suT62-0005YD-Nd; Sat, 28 Sep 2024 04:46:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suT60-0005Y0-IB for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 04:46:32 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1suT60-0000ef-9G for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 04:46:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=oQAD/tzNwFnQYy9vTN98Tda38+TR39bkJSk+WIPFVg0=; b=dfDyjTnfQqDNUFz5dBF0JpehXtBg1fBd2NnaLFiIYjz95Zo2FKx8d7uX5zL0LH9ugcZ4Jj7Y7qa6rkn3UcieRstIBbaPFSONIRCJSlYsfgzJoqgpup3oynv/15sN4Lehnf54nNeE8YtSYUrpCXzOe+p+GE7hgXP85GIzyDYm4JwB6apkkSRfjyRLO3Y2JVjNVJYb0LjNKObGUpCUqRrLkAFGtj7Ue45s3RFeDMDLb+aUKSR8vhsnVsUwYStLeC/zJEG1upIbEEuX5EPTXfuxMaCg7zSLwumT3XrE7e5SEmWObVhZUU45c+oKcRdj/O9Bld4BRaPvMOe8Wqb89BHJIQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1suT6T-00052X-Sy for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 04:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Sep 2024 08:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73206 X-GNU-PR-Package: emacs Original-Received: via spool by 73206-submit@debbugs.gnu.org id=B73206.172751318919313 (code B ref 73206); Sat, 28 Sep 2024 08:47:01 +0000 Original-Received: (at 73206) by debbugs.gnu.org; 28 Sep 2024 08:46:29 +0000 Original-Received: from localhost ([127.0.0.1]:51740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suT5w-00051O-US for submit@debbugs.gnu.org; Sat, 28 Sep 2024 04:46:29 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59484) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suT5v-00050k-0v for 73206@debbugs.gnu.org; Sat, 28 Sep 2024 04:46:27 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suT5L-0000bR-O9; Sat, 28 Sep 2024 04:45:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=oQAD/tzNwFnQYy9vTN98Tda38+TR39bkJSk+WIPFVg0=; b=GoaYP5RjCJ1ib/y0P/D7 sKQR8Ofu1Wbhv6fvB9Zcl5f3H4q+53DjnFxk7hMky/trR7j435sEIgqVNPfYAUQjO3s8Tcz9l/KfP lB9H/tdUiBERc1ZIUN8Z1hpt81QpegAxLv36Mpxkfs1I9dWMfIzJEZbVE7OqGjHOtqnJKwKite+Di Yv1zhb6mZTaQXuTwCFEy1gWK8cYcS05EIEwvAsBtu6DBXGwkw+tO9yfBmG/KkG9RBiz8i2mG3nb4K 5plkO7mW+h2okyQ9gWAaYYPxp3AVhbATOSLWia/otdT4vWBn6APkP3i/wV6sA8k0DQeCF/tmi8zXz wufy6HiquNp6Sg==; In-Reply-To: (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292548 Archived-At: Stefan, does the patch with the regexp fix look correct to you? > Date: Sun, 15 Sep 2024 12:08:17 +0000 > msip_labels: > From: John Ciolfi via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Thanks for catching my typo and for moving the fix along. > ----------------------------------------------------------------------------- > From: Robert Pluim > Sent: Friday, September 13, 2024 3:43 AM > To: 73206@debbugs.gnu.org <73206@debbugs.gnu.org> > Cc: John Ciolfi > Subject: Re: bug#73206: 28.2; xml comment with blank lines to do not indent correctly, nxml-mode.el > > >>>>> On Thu, 12 Sep 2024 13:53:26 -0400, John Ciolfi via "Bug reports for GNU Emacs, the Swiss army > knife of text editors" said: > > John> 1. Create foo.xml containing: > > John> > John> > John> > > John> Notice that we have a blank line in the xml comment. > > John> 2. Put the point on 'bar' and press TAB. > > John> Notice that the 'bar' line is not indented correctly. > > John> Solution > John> -------- > > John> The problem is that in nxml-compute-indent-in-delimited-token, there > John> is a (forward-line -1) which assumes that the prior line is indented. In > John> this case the prior line is a blank line and thus doesn't have > John> indentation. After the (forward-line -1), we need to keep going back > John> until we see a non-blank line: > > John> (forward-line -1) > John> + (while (looking-at "^[:blank:]*$") > John> + (forward-line -1)) > > John> Attached is a patch for nxml-mode.el that fixes the issue. > > Your patch does the right thing, but for the wrong reasons. Regexp > character classes only have meaning with a bracket expression, so what > you˘re matching here is actually any lines containing zero or more of > ':', 'b', 'l', 'a', 'n', or 'k'. IOW, you should use: > > (looking-at "^[[:blank:]]*$") > > Robert > --