unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: John Ciolfi <ciolfi@mathworks.com>,
	Stefan Kangas <stefankangas@gmail.com>
Cc: 73206@debbugs.gnu.org, rpluim@gmail.com
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	[thread overview]
Message-ID: <86v7yg6u9x.fsf@gnu.org> (raw)
In-Reply-To: <MN2PR05MB676630F8B5B626E5EDA991FCD1672@MN2PR05MB6766.namprd05.prod.outlook.com> (bug-gnu-emacs@gnu.org)

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" <bug-gnu-emacs@gnu.org>
> 
> Thanks for catching my typo and for moving the fix along.
> -----------------------------------------------------------------------------
> From: Robert Pluim <rpluim@gmail.com>
> Sent: Friday, September 13, 2024 3:43 AM
> To: 73206@debbugs.gnu.org <73206@debbugs.gnu.org>
> Cc: John Ciolfi <ciolfi@mathworks.com>
> 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" <bug-gnu-emacs@gnu.org> said:
> 
>     John> 1. Create foo.xml containing:
> 
>     John> <foo>
>     John>     <!--
>     John>         foo
> 
>     John> bar
>     --> 
>     John> </foo>
> 
>     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
> -- 





  reply	other threads:[~2024-09-28  8:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 17:53 bug#73206: 28.2; xml comment with blank lines to do not indent correctly, nxml-mode.el John Ciolfi via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-13  7:43 ` Robert Pluim
2024-09-15 12:08   ` John Ciolfi via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-28  8:45     ` Eli Zaretskii [this message]
2024-09-29 20:47       ` Stefan Kangas
2024-10-02 11:59         ` John Ciolfi via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86v7yg6u9x.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73206@debbugs.gnu.org \
    --cc=ciolfi@mathworks.com \
    --cc=rpluim@gmail.com \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).