From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#73206: 28.2; xml comment with blank lines to do not indent correctly, nxml-mode.el Date: Fri, 13 Sep 2024 09:43:09 +0200 Message-ID: <87h6akknhu.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37502"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ciolfi@mathworks.com To: 73206@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 13 09:45:15 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 1sp0zS-0009YE-Nk for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Sep 2024 09:45:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp0zA-0008Eh-Qs; Fri, 13 Sep 2024 03:44:56 -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 1sp0z7-0008ET-UT for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2024 03:44:54 -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 1sp0z7-0002B6-JF for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2024 03:44:53 -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:Date:References:In-Reply-To:From:To:Subject; bh=ofIUnE0WtgOwZtPllazQ5OIB5/Q81BxV1kOTkSgaVNQ=; b=IJ30YEcXJc0ocXPqhoRLiZdJorRcUkdpq9OVEXHQpLqhQi78HzKTIGsU5Dr3+2xvp9YDx9E1CAXj1tm2PWsXa4EqreTFOPtbnEE/MLVeT6qJjpBscj9ADwWWBDSHpKeG99jli4Gghb49vPxDkPY4sLT30WH5KnJCejF0Ewe7QPOOEPuPcMBhgPX80KqZu1dAnGRmrIzO8LzQye2BVf+w8fFNnecqma7GEeoPjkhEoSfHM9+Ag9+iv839TtGnX+8V8jLQVJJfXfW+lxrtXWJRJhiALiG1UKCiUXobvT5ob6d1aGBQXxQillctbHPcHi+5+IhKcmaqzTAIyOCLIhL3LA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sp0zG-0003N1-5V for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2024 03:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Sep 2024 07:45: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.172621346812885 (code B ref 73206); Fri, 13 Sep 2024 07:45:02 +0000 Original-Received: (at 73206) by debbugs.gnu.org; 13 Sep 2024 07:44:28 +0000 Original-Received: from localhost ([127.0.0.1]:42370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp0yi-0003Ll-EQ for submit@debbugs.gnu.org; Fri, 13 Sep 2024 03:44:28 -0400 Original-Received: from mail-wm1-f42.google.com ([209.85.128.42]:61499) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp0yg-0003LV-ET for 73206@debbugs.gnu.org; Fri, 13 Sep 2024 03:44:27 -0400 Original-Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-42cafda818aso17349605e9.2 for <73206@debbugs.gnu.org>; Fri, 13 Sep 2024 00:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726213391; x=1726818191; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ofIUnE0WtgOwZtPllazQ5OIB5/Q81BxV1kOTkSgaVNQ=; b=K2ITlYFdfW68QRWry05nTSjaBPCfFZVRc/3R7mrPqIGpQ/mRSgq8T7COV1vyrHpH+i +oMmDpXnAaolNG8EY9bj8GsgP8tTLTeSY19lHUClnel4aIhXKl49GhLVfLrHHZuiR6XJ gjXwu0yDzERCqdDk3U4cjEYdt0sl15XXhutk+s+q2eb7w0WXMe7JeQs9z3w2ZZhX/ZiF rCLMMR68vYVvHcdvxirkL61RJ1Wyt4rK3QsdUT/efKX+SSI/qnl/y/xvTskfqgJHzMGB fqDCF4dkOHSIABrSu+C764ierOLqSvDwLrf1HR6AAOyOTLIoAPyFcKDGmzBL+eCmC0mH D/1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726213391; x=1726818191; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ofIUnE0WtgOwZtPllazQ5OIB5/Q81BxV1kOTkSgaVNQ=; b=GIGGfirkGl8rBTZ2dTldmRw3XdfeQfXlpwRC1xB6r5OAtVIa2eVgOJya5uMjTmdL+u CrMIkXG6H9PxCeJ5pe92d5kpGnRiLVjBXNvh5GgdW4/FgJj92y7/Ki/HCxvz4Q1aL5mN F1fDiUz2UsfMvkPLcQFNda2R9yRgewZNAT1XCFIfeDJtLKLI3EAQoZ8KdNG8U9xeTcZq wFuheEouxtLCTymMyUc7fD41t+qlnTF7Izv31HOuRbQhuyp0UfzvnjXE6xxapoaHgU1L dFq9NhuQSzR+I8kO9UQP4URbuGk7XcKkQCVXSR/XMdHngbrR/k8zkInkrQqAEY/A34Tc tDNQ== X-Gm-Message-State: AOJu0YxZ4ZAgWPQRiCsT3zbjRp8v3aL421rbgiE8OD4ZuuCN1yYoCrni 2WpBU5Bo46U6UlTI0gPAEvBtJAQXLwzC962Rf3eT80ivRqpTKNqo X-Google-Smtp-Source: AGHT+IHCC/1RMyIRKAQ3Y8fcAvblYqP7D/k8cUh35e/z5opwtMxUYJLi1SYBOPo8LYdrtBBrXqAeMg== X-Received: by 2002:a05:6000:401f:b0:371:7e3f:6cc with SMTP id ffacd0b85a97d-378c2cfec94mr3711706f8f.9.1726213391004; Fri, 13 Sep 2024 00:43:11 -0700 (PDT) Original-Received: from rltb ([2a01:e0a:3f3:fb51:b06c:5c59:1e31:5a35]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956650fdsm16139245f8f.25.2024.09.13.00.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 00:43:10 -0700 (PDT) In-Reply-To: (John Ciolfi via's message of "Thu, 12 Sep 2024 13:53:26 -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:291648 Archived-At: >>>>> 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> =20 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)) =20 John> Attached is a patch for nxml-mode.el that fixes the issue.=20 Your patch does the right thing, but for the wrong reasons. Regexp character classes only have meaning with a bracket expression, so what you=CA=BCre 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 --=20