From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John Ciolfi via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73206: 28.2; xml comment with blank lines to do not indent correctly, nxml-mode.el Date: Sun, 15 Sep 2024 12:08:17 +0000 Message-ID: References: <87h6akknhu.fsf@gmail.com> Reply-To: John Ciolfi Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_MN2PR05MB676630F8B5B626E5EDA991FCD1672MN2PR05MB6766namp_" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31525"; mail-complaints-to="usenet@ciao.gmane.io" To: Robert Pluim , "73206@debbugs.gnu.org" <73206@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 15 14:09:01 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 1spo3p-00083L-1S for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 Sep 2024 14:09:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spo3g-0006NI-O9; Sun, 15 Sep 2024 08:08:52 -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 1spo3e-0006Mo-QY for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 08:08:50 -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 1spo3e-0007IB-Hm for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 08:08:50 -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:In-Reply-To:References:Date:From:To:Subject; bh=1vqyvxS45Zj44JkxmMKV4tyGBrt1+NcRqhsNSZdJXSc=; b=UpaxJ3j14OiwdSMiYXSGWhPXktchYbOQS5d2aPiaDydfJhASXBu+ipAdsyWf84iUYpIq8khaKgPXELNuBVr5zhC+7VsKVTYWhDc44LMgSv0a0H15ioxMXlT13Lzrpqro7WC5yzYPh5AgzbAuK+rSsJDeic3lucenMeQX4txKKqYf6BbxMbEjoaayguIun1GRy5cTWr9wE1I5fsA/H9qeAJRmJtYAt7+vrud08foThSoBkkpLLXTXmyNx7+O+vueIAPlZDccW+/Vekxnb0iKiJ0MtCtNJs1F5lkrnC3ZGiA0X0h7DVs5rG0FLg4OGQ6q7hyNyCJyoF6PSKU3zdoz/1w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1spo3q-00006c-Ar for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 08:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Ciolfi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Sep 2024 12:09:02 +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.1726402120374 (code B ref 73206); Sun, 15 Sep 2024 12:09:02 +0000 Original-Received: (at 73206) by debbugs.gnu.org; 15 Sep 2024 12:08:40 +0000 Original-Received: from localhost ([127.0.0.1]:48551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spo3T-00005y-KC for submit@debbugs.gnu.org; Sun, 15 Sep 2024 08:08:40 -0400 Original-Received: from us-smtp-delivery-120.mimecast.com ([170.10.133.120]:34177) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spo3R-00005p-H4 for 73206@debbugs.gnu.org; Sun, 15 Sep 2024 08:08:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mathworks.com; s=mimecast20180117; t=1726402104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1vqyvxS45Zj44JkxmMKV4tyGBrt1+NcRqhsNSZdJXSc=; b=KhngzJ16jCqvXATiRofeJtI4jPHqShm8cBFspq3XyQslyOXbBlDiNl85Octrn3ARVhcWXD BTir8KXLVEdn3JKoaNefXvfcRzt0TXeeZTXVs/8nfxHWZeAjwG5ogWpmzg/yhPFQyOoRaX uR4ehkmT7T5oTeXVnXRl3MbuGjcyCCM= Original-Received: from BYAPR05CU005.outbound.protection.outlook.com (mail-westusazlp17010006.outbound.protection.outlook.com [40.93.1.6]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-96-HPmCYuSbN1-F4VHIy6cRdg-2; Sun, 15 Sep 2024 08:08:22 -0400 X-MC-Unique: HPmCYuSbN1-F4VHIy6cRdg-2 Original-Received: from MN2PR05MB6766.namprd05.prod.outlook.com (2603:10b6:208:185::15) by CH3PR05MB10028.namprd05.prod.outlook.com (2603:10b6:610:12a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.22; Sun, 15 Sep 2024 12:08:18 +0000 Original-Received: from MN2PR05MB6766.namprd05.prod.outlook.com ([fe80::5ea6:b1eb:653c:426f]) by MN2PR05MB6766.namprd05.prod.outlook.com ([fe80::5ea6:b1eb:653c:426f%6]) with mapi id 15.20.7962.022; Sun, 15 Sep 2024 12:08:17 +0000 Thread-Topic: bug#73206: 28.2; xml comment with blank lines to do not indent correctly, nxml-mode.el Thread-Index: AQHbBTy3wtVaBrQozEqF93tHMuSqjrJVVsC4gANujs8= In-Reply-To: <87h6akknhu.fsf@gmail.com> Accept-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR05MB6766:EE_|CH3PR05MB10028:EE_ x-ms-office365-filtering-correlation-id: 5a72c340-f0dc-4b08-8466-08dcd57f157b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|1800799024|376014|38070700018 x-microsoft-antispam-message-info: 3Lt2v57ylYx+SJ69aB7bXNRWCdD1Z7+J1RiuueaY3sKCsYJOsHQBGGMVrfxxlAdN9NG9G49akjBrD0ddRragPx2P/NSiBgGVwk+WS/N0ZUCmKjHBW/sstsVl8iIVXIPz5UYdtDwfZQJhxE5PS4HAWp6ratbvoDbELQIZtzX2Zvki4jHY6VNRH+D9tNemHOywlufcRMcU+HrV2Qpi2pWBg+vHIyMa/rGGOz5hzSu+n5UrtrOZ+EYiGXVu1hrcTudZZ7yeHw02ChScESo8k8tjDOzKgkDJTHXd5aGXDzTt4YXy4yRZ3HaQqnsyqQNf0zBEfCt09kZ1+Oz66MHEcz9bFwCW9+KVM/jmzbEGZCjHKLVy0Xy+uY3NX8qISD5IYKIZxYGabeb9h+TN/C8LhHbC4Jl3TdzvscumZ8hn9h4K97CK0ZcX5XESJlftxNDY8A+gviNRtAbc9fGKl/71Pw46etugmnX8jUB8EOyAodD1P8sxtmY5BhuuLpJRuhZGJewGJIgcxC3BMEEBywghZpSE/kPRVsqk6U3Qr77LUNAgdfjuO8LVsYnCMbG9llB6f4xwDeqvTXqE5uOYY2UoECkhq3sRFZl50z6DKFICbrcWjrupapciMMMlFmO01XZrybz8hstJk1IJWnUr6Vs3v/JyXZvlMFu/C7vcgNJyLIYcfi2OXKeORkUm8AdU8IEJ0/xm/bpNfMee3RhqzW8Mc1On/35TWFfSjakj8HbEydfIO4bf0u8DZxSQbVCakSLD9 FrMrNZ2ujFzNR6gIFFoEyumXgf987Lbn8ROjUVMumnIOj8Caoilo1CYaTxV4Vt8LMLbQlVS2ug5cq1BrvzIuUcpZ4PyyBIfHYp x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR05MB6766.namprd05.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1102 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: YW5TZEnxSYrEjpqMKexHPE4mw/DrS9c6Kzk+5GPsqYQyVWs+IT/rNfu/AZ6BmsJSQZq6jLwBhhZJW+RNoWlekBhy18AtepbZCrfEZGoxLBNMISzUxvUnJcfwsCbqQN7lIE3ZIb21mwE1R0GywOCP+3Jmgwy7TaDLvr1jNVLfNiyUXpBzBlzETW5CfbF45YVuKdJBuwhTPuA7L3hjvmplMSgfg2xiYLev1EQBr86Gsii9r8hUgYxedLWcCthuwln4uufh/8sFbuznze+4LUenPeN34aiwAvEL0RSeVdsiJ0n4/+Mns6UlursX8RfvRR4oGTKpyohPuM5DNBaq0B/wdP3h0pNweUEcibSuywZjS3sEcUHsSsVnpxhr7Vjjg080VXIduMKu+7QMIkJ8hWy384Jult9uRqE9Tj3x6ZYDMs99CtQlYDykprHSuRAP9tKOh76EpefJ/d0aKld2T2Oxgq4gmSYv1Opd9M/td4uudiXOdYEcbrlbA56h8sEDelym0JTmEBujKEJX4R10fA97kwkBrgSjfH7Rq3uNKO/TwWjodzn51QWgFbs7E6iO+fpDaqxDFO+KjdCYynn/cActVKHCoGmU/NOqcRX3q/U6BWDs6kUWu2PFn+XEztCwyU4uKpR0QtdZb8At4a4cUdno2Y4f861M4YCZftNlrQCAty7ie04NpVbDKI+47lpyOzdWEJmpjkRrWw6q7xVpI8rprQoQke4kKL7Rgh+k6f1x83/Vv00hN/S3X4Roan VdyDeKLSzZYu6kU+YOao6a6O0+BR88tksF8cwXMrYIrBre4HFqLXzCZ2hgnM64w/AxYfHlZEQuEdBydUEMUnUgVi8lSPboMb/d X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0PDU+pFZ+MUsAlq6Hk/lwjRexdxgd62fBcdQvgaAonqj3ZXJXIuL0hwgXXbXLATTCcIxyDrwvdbJxqVmJpeOTeJ5rkj1ezW7ynWJdU59H1dSYVBwmSJW0cbkp2QfjX3gc3ga2001YirS41Q3XRQ06y4zvMkrLkBKdvQydkCjTffj5X2dtM9Iucb2dTwY4Oq0jXgj9xOob0Tjbm9rOVZ/DnWgQEzRFFeSGINCKUkW4lLjO9xaKJUqxyG12I2icb0ykf4INqF6winaMJQTIb3fEUlZyOdj7hGIjcMSyXH0V5H2G+Eqg9InMyrhl58tyblxb1hRRJy0CZUFJSTRYGjon3yoerwp3+kbDVRuUyDWgXNGW64ocu6maZJS4Hbhjs1n0DCnayEtSwWMNSHpERPjJu1Qba1pCcThNpL/whVZhSVbYCAMLj3u7t/K2UGk+scpFHHRAukf87/LSyjUfuZ9+Ziauzy6iwloiH8slgJ38bR58vk/wg6qqmMdGU+XOHuuIXNVU2qCtOFMLV0EUcSJgdDvD9xEtBWREeAY8sZ0yHpGtk4IVMXIaR1C0V+7EfNfBVl/cNfQbPk6hI5m6xCve+35sSwlf6A6nrxMFKEH+z1t5134C/UfwZ6RZS3YBzsB X-OriginatorOrg: mathworks.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR05MB6766.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a72c340-f0dc-4b08-8466-08dcd57f157b X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2024 12:08:17.7394 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 99dd3a11-4348-4468-9bdd-e5072b1dc1e6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: cihsb/hV1w1Mpb1Bue3NdjV/Om+tFDdQ36KFnn7JsyV6cFIO3Nv28I7FmHxsoG5TV0aQL5L685mAGRVpgToZvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR05MB10028 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: mathworks.com Content-Language: en-US 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:291848 Archived-At: --_000_MN2PR05MB676630F8B5B626E5EDA991FCD1672MN2PR05MB6766namp_ Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable 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" sa= id: 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, th= ere John> is a (forward-line -1) which assumes that the prior line is inden= ted. 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 b= ack 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=A2re 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 -- --_000_MN2PR05MB676630F8B5B626E5EDA991FCD1672MN2PR05MB6766namp_ Content-Type: text/html; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable
Thanks for catching my typo and for moving the fix along.

From: Robert Pluim <rplu= im@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 knif= e 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 com= ment.

    John> 2. Put the point on 'bar' and press TAB.

    John> Notice that the 'bar' line is not indented corr= ectly.

    John> Solution
    John> --------

    John> The problem is that in nxml-compute-indent-in-d= elimited-token, there
    John> is a (forward-line -1) which assumes that the p= rior line is indented. In
    John> this case the prior line is a blank line and th= us doesn't have
    John> indentation. After the (forward-line -1), we ne= ed to keep going back
    John> until we see a non-blank line:

    John>        =    (forward-line -1)
    John> +       &nbs= p;   (while (looking-at "^[:blank:]*$")
    John> +       &nbs= p;  (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=A2re 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
--

--_000_MN2PR05MB676630F8B5B626E5EDA991FCD1672MN2PR05MB6766namp_--