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#7937: nxml-mode indenting bug fix. Date: Thu, 30 Mar 2023 09:56:36 +0300 Message-ID: <83o7oa682j.fsf@gnu.org> References: <87tygr9ych.fsf@jidanni.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13242"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 7937@debbugs.gnu.org To: Stephen Meister Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 30 08:57:43 2023 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 1phmEA-0003Fb-7S for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Mar 2023 08:57:42 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phmDZ-0002D4-BP; Thu, 30 Mar 2023 02:57:05 -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 1phmDX-0002CX-HO for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 02:57:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phmDX-00011D-9j for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 02:57:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phmDV-0005ol-Kb for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 02:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Mar 2023 06:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7937 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 7937-submit@debbugs.gnu.org id=B7937.168015939622330 (code B ref 7937); Thu, 30 Mar 2023 06:57:01 +0000 Original-Received: (at 7937) by debbugs.gnu.org; 30 Mar 2023 06:56:36 +0000 Original-Received: from localhost ([127.0.0.1]:55602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phmD6-0005o6-AX for submit@debbugs.gnu.org; Thu, 30 Mar 2023 02:56:36 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phmD3-0005nq-0A for 7937@debbugs.gnu.org; Thu, 30 Mar 2023 02:56:33 -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 1phmCx-0000tM-Gj; Thu, 30 Mar 2023 02:56:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+any+D/41w3U8SdZs97fyEEzG1RYCk9KDfKgssyT+8k=; b=mPjxhoDZjPMr 9H0il7P92rLTz8rWiQdikMNBqV7bHP+Fv2NgbbT1kE9dcNF0GH2s4QzR/0JSPQjlW2VcW7t/fn2Or TYQluGL0dapsLx7MiUJRSDzaVE957yEmN3FsX7kjGisBKim3WjzUQf72JEzv023tNAgINn2wcxQlV hHuvMbpXVVfLCC1cyU/odYIye9DnbYHV/1138MjqnCcVw3V9aoiOknP7SCmdw5XXB2IT2zUy9WeoV D/LmUjj9CGRWiQ1pQ7QI19IZhbS6zt9aAomrBJMn9G8wsaHG2BKdcgDu+9k4OewojndQZ5yMAo8Up KmYCv4/5ymKu/GkAPZ4r/A==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phmCw-0004ab-Ii; Thu, 30 Mar 2023 02:56:26 -0400 In-Reply-To: (message from Stephen Meister on Tue, 28 Mar 2023 15:05:05 -0400) 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:258896 Archived-At: > From: Stephen Meister > 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: > > > > inner > > > > > > Which would now be indented as: > > > inner > > > > 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.