emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ffb7bbd: * sgml-mode.el (sgml-syntax-propertize-rul


From: Stefan Monnier
Subject: [Emacs-diffs] master ffb7bbd: * sgml-mode.el (sgml-syntax-propertize-rules): More verbose comments
Date: Tue, 4 Jun 2019 12:26:57 -0400 (EDT)

branch: master
commit ffb7bbdf6824054316a6f63df22eea6d8887bdbd
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * sgml-mode.el (sgml-syntax-propertize-rules): More verbose comments
---
 lisp/textmodes/sgml-mode.el | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index da25665..0c5d5e56 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -368,11 +368,24 @@ Any terminating `>' or `/' is not matched.")
      ;; if it's outside of tags, but there are too many quotes and
      ;; the resulting number of calls to syntax-ppss made it too slow
      ;; (bug#33887), so we're now careful to leave alone any pair
-     ;; of quotes that doesn't hold a < or > char, which is the vast majority.
+     ;; of quotes that doesn't hold a < or > char, which is the vast majority:
+     ;; either they're both within a tag (or a comment), in which case it's
+     ;; indeed correct to leave them as is, or they're both outside of tags, in
+     ;; which case they arguably should have punctuation syntax, but it is
+     ;; harmless to let them have string syntax because they won't "hide" any
+     ;; tag or comment from us (and we use the
+     ;; font-lock-syntactic-face-function to make sure those spurious "strings
+     ;; within text" aren't highlighted as strings).
      ("\\([\"']\\)[^\"'<>]*"
       (1 (if (eq (char-after) (char-after (match-beginning 0)))
+             ;; Fast-track case.
              (forward-char 1)
-           ;; Avoid skipping comment ender.
+           ;; Point has moved to the end of the text we matched after the
+           ;; quote, but this risks overlooking a match to one of the other
+           ;; regexp in the rules.  We could just (goto-char (match-end 1))
+           ;; to solve this, but that would be too easy, so instead we
+           ;; only move back enough to avoid skipping comment ender, which
+           ;; happens to be the only one that we could have overlooked.
            (when (eq (char-after) ?>)
              (skip-chars-backward "-"))
            ;; Be careful to call `syntax-ppss' on a position before the one



reply via email to

[Prev in Thread] Current Thread [Next in Thread]