all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stephen Meister <pallagun@gmail.com>
Cc: 7937@debbugs.gnu.org
Subject: bug#7937: nxml-mode indenting bug fix.
Date: Thu, 30 Mar 2023 09:56:36 +0300	[thread overview]
Message-ID: <83o7oa682j.fsf@gnu.org> (raw)
In-Reply-To: <CAMrh0GMapEMPaeR=y=qYu8MHXpA5DhsSejcWXLMeWB4e_f26CA@mail.gmail.com> (message from Stephen Meister on Tue, 28 Mar 2023 15:05:05 -0400)

> From: Stephen Meister <pallagun@gmail.com>
> Date: Tue, 28 Mar 2023 15:05:05 -0400
> 
>   I've tried to put a fix in place for bug 7937 (and possibly 7768 unintentionally).  The repair I've made will
> cause changes in the way that nxml indents lines under normal circumstances.  I'm not sure if a change like
> this is acceptable given that I'm only trying to fix a bug.  The behavior change is most visible in a situation
> such as:
> 
> <root>
>   <a><b><c>
>     inner
>   </c>
> </b>
>   </a>
> </root>
> 
> Which would now be indented as:
> <root>
>   <a><b><c>
>         inner
>       </c>
>     </b>
>   </a>
> </root>

Sounds like the new behavior is better.  So I'm okay with this change
in behavior.

> This is my first bug fix, please let me know if I've missed anything (procedurally or otherwise).  I'm happy to
> rework/restructure this based on any suggestions.

Thanks, please see a few minor comments below.

> diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
> index 3869d0327fd..74108fa9d73 100644
> --- a/lisp/nxml/nxml-mode.el
> +++ b/lisp/nxml/nxml-mode.el

Please accompany the patches with a ChangeLog-style commit log
message.  The file CONTRIBUTE in the Emacs source tree describes our
conventions for writing log messages, and you can use "git log" to see
these conventions in action in our repository.

Also, please try to use "git format-patch" to format the patches, as
that makes it easier for us to install the patches.

> @@ -1352,15 +1354,19 @@ nxml-compute-indent-from-matching-start-tag
>  	     (goto-char xmltok-start)
>  	     (skip-chars-backward " \t")
>  	     (bolp))
> -	   (current-indentation)))))
> +	   (+ (current-indentation)
> +              ;; in the case of a line starting with data, keep the
> +              ;; indent level above the starting tag.

Comments should start with a capitalized letter.

> +          (nxml-tokenize-forward)
> +          (when (> (point) bol)         ; one token spans this and the line before
> +            (throw 'indent (nxml-compute-indent-in-token bol)))
> +          
> +          ;; Scan over the prevous line to determine the change in element depth
> +          (setq start-type-before xmltok-type)
> +          (while (< (point) bol)        ; examine all tags on the previous line

Comments should end with a period (i.e., should be full English
sentences), and should not overflow the 80-column line length, and
preferably not the fill-column as well.





      reply	other threads:[~2023-03-30  6:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-29 21:47 bug#7937: nxml-mode.el indenting wrong when more than one <> on a line jidanni
2019-10-14 15:41 ` Stefan Kangas
2019-10-18  8:19 ` 積丹尼 Dan Jacobson
2020-08-07 10:32   ` Lars Ingebrigtsen
2023-03-28 19:05 ` bug#7937: nxml-mode indenting bug fix Stephen Meister
2023-03-30  6:56   ` Eli Zaretskii [this message]

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

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

  git send-email \
    --in-reply-to=83o7oa682j.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=7937@debbugs.gnu.org \
    --cc=pallagun@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.