From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#18871: 24.4; nxml-mode: DTD edition breaks the file structure Date: Sat, 18 May 2019 14:58:53 -0400 Message-ID: <87o93zd1xu.fsf@gmail.com> References: <878uk0qn46.fsf@ypig.lip.ens-lyon.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="181191"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: 18871@debbugs.gnu.org To: Vincent Lefevre Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 18 21:11:05 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hS4jY-000kza-Jd for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 May 2019 21:11:04 +0200 Original-Received: from localhost ([127.0.0.1]:37669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hS4jX-0008I0-EO for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 May 2019 15:11:03 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hS4de-0002lS-Q2 for bug-gnu-emacs@gnu.org; Sat, 18 May 2019 15:04:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hS4Ys-0000q0-VJ for bug-gnu-emacs@gnu.org; Sat, 18 May 2019 15:00:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47675) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hS4Ys-0000od-G4 for bug-gnu-emacs@gnu.org; Sat, 18 May 2019 15:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hS4Ys-0001fd-8T for bug-gnu-emacs@gnu.org; Sat, 18 May 2019 15:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 May 2019 19:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18871 X-GNU-PR-Package: emacs Original-Received: via spool by 18871-submit@debbugs.gnu.org id=B18871.15582059436321 (code B ref 18871); Sat, 18 May 2019 19:00:02 +0000 Original-Received: (at 18871) by debbugs.gnu.org; 18 May 2019 18:59:03 +0000 Original-Received: from localhost ([127.0.0.1]:32986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hS4Xu-0001do-Ny for submit@debbugs.gnu.org; Sat, 18 May 2019 14:59:03 -0400 Original-Received: from mail-io1-f67.google.com ([209.85.166.67]:34480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hS4Xs-0001dE-UL; Sat, 18 May 2019 14:59:01 -0400 Original-Received: by mail-io1-f67.google.com with SMTP id g84so8074496ioa.1; Sat, 18 May 2019 11:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=IbsZHduRHrMARgUQnC5hHCZXRYi9M/DzbaRzJ6hgc5Y=; b=qe30kZm5Jwl/2+2gOwWtWeoj4KA7UjVw26foeymkkkNFCy3plXuQGTIuaFRQbk+eMD zGvzsuLxvCobyuHeBJH/QGhmohaVsn6P7Q0VLrp6yf3wgVzV2MIYMDvCZS1jQWSBuDUr f9p+hZgbDPZ+y2uDxKo9d5GO6vI7MYL+CwWAy0VcQ3MBggD3qJB20S2KpReeAIhAiBR5 32UPVfkJxAVOkZ7AcC0XM7x2XIbO60C5Ju7betGXH4Sj80tUIsz9z7VdoTaLFHr4wmYO KIe1tFSJteu7LQHxY6elDpoKNkErQial1cktyVuf4/IBt2Z9okwESD1jufXcqXciyCNE L1vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=IbsZHduRHrMARgUQnC5hHCZXRYi9M/DzbaRzJ6hgc5Y=; b=eCeywlCsGY5yQa6H07aPHWjMWC/h4TFJIKTh/L+xSJM5sqnY3PoaxIMABOvorN5mxh w471ugbki0om78FNzU3Kf0wgWsvXV4+Ws6mzmByzWzisSlQxpnTuvx8GfaDSP3c+eVPV Ok2IhajoRLEAK9iI6nmOe+bthmVcVDVdfVtPE+iKa8l6tggzlBuhIkjiDDAujGvJJ6Rm hcUrHrOgmykC3kSLspzt1BwUfM8Gt/082Opz0Zow6hSEJzfHcRmC3grdzswekrO19uao LticywLM5YNDMapIXCzgiMKuTlH8hyVIx0tzu61HUp3rGhuSf/Nd09fMaBoODBu1h0YB BrNQ== X-Gm-Message-State: APjAAAWLNxVQvMmR/YtviueFrJCg3WPViIt2sIarewVrA15vhZ7jw5T9 hU2EYHtsAKb0EKk/OnSai/PxIqG2 X-Google-Smtp-Source: APXvYqxxQB8Wk36CbMbEF+OciUriKIm7Pg3YLuyTszr4VayldaaWSXD/J1Rc7OuhJLE3vSJF08uwTQ== X-Received: by 2002:a5d:8357:: with SMTP id q23mr36248760ior.10.1558205934966; Sat, 18 May 2019 11:58:54 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id r22sm3937000ioh.54.2019.05.18.11.58.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 May 2019 11:58:54 -0700 (PDT) In-Reply-To: <878uk0qn46.fsf@ypig.lip.ens-lyon.fr> (Vincent Lefevre's message of "Tue, 28 Oct 2014 15:34:33 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:159505 Archived-At: --=-=-= Content-Type: text/plain tags 18871 + patch merge 18871 23668 quit Vincent Lefevre writes: > Consider the following XML file: > > ------------------------------------------------------------------ > > > > ]> > > > > > ------------------------------------------------------------------ > > 1. Open it with "emacs -Q". > 2. Go to line 2 and type C-SPC. > 3. Go to line 6 and type C-w to delete the DTD. > > The highlighting gets completely wrong. And if I delete the closing > tag (with C-k) and type C-c C-f, I get the error: > > No matching start-tag > > In more complex files, slightly editing the DTD gives the same behavior. Should be fixed by this patch. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Keep-nxml-prolog-end-up-to-date-Bug-18871.patch Content-Description: patch >From 5f6abb03b3b0d10dd39ece8c151a8a7857b85895 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 18 May 2019 14:54:36 -0400 Subject: [PATCH] Keep nxml-prolog-end up to date (Bug#18871) The change on 2016-01-16 "lisp/nxml: Use syntax-tables for comments" removed the update of nxml-prolog-end, although it already failed to work correctly after 2013-10-07 "* lisp/nxml/nxml-mode.el: Use lexical-binding and syntax-propertize." * lisp/nxml/nxml-rap.el: New function. * lisp/nxml/nxml-mode.el (nxml-mode): Add it to after-change-functions. --- lisp/nxml/nxml-mode.el | 1 + lisp/nxml/nxml-rap.el | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 7c39c5023c..b816bba819 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -534,6 +534,7 @@ nxml-mode (setq-local syntax-ppss-table sgml-tag-syntax-table) (setq-local syntax-propertize-function #'nxml-syntax-propertize) (add-hook 'change-major-mode-hook #'nxml-cleanup nil t) + (add-hook 'after-change-functions #'nxml-maybe-rescan-prolog nil t) ;; Emacs 23 handles the encoding attribute on the xml declaration ;; transparently to nxml-mode, so there is no longer a need for the below diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el index 21dbaded25..2be3981047 100644 --- a/lisp/nxml/nxml-rap.el +++ b/lisp/nxml/nxml-rap.el @@ -108,6 +108,12 @@ nxml-scan-prolog (setq nxml-prolog-regions (xmltok-forward-prolog)) (setq nxml-prolog-end (point)))) +(defun nxml-maybe-rescan-prolog (start _end _length) + "Reparse the prolog if START lies within it. +`nxml-mode' adds this function on `after-change-functions'." + (when (<= beg nxml-prolog-end) + (save-excursion + (nxml-scan-prolog)))) ;;; Random access parsing -- 2.11.0 --=-=-=--