aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/textmodes/sgml-mode.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 6dc1b9e727e..11b30537e67 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -339,12 +339,21 @@ Any terminating `>' or `/' is not matched.")
339 ("--[ \t\n]*\\(>\\)" (1 "> b")) 339 ("--[ \t\n]*\\(>\\)" (1 "> b"))
340 ("\\(<\\)[?!]" (1 (prog1 "|>" 340 ("\\(<\\)[?!]" (1 (prog1 "|>"
341 (sgml-syntax-propertize-inside end)))) 341 (sgml-syntax-propertize-inside end))))
342 ;; Quotes outside of tags should not introduce strings. 342 ;; Quotes outside of tags should not introduce strings which end up
343 ;; Be careful to call `syntax-ppss' on a position before the one we're 343 ;; hiding tags. We used to test every quote and mark it as "."
344 ;; going to change, so as not to need to flush the data we just computed. 344 ;; if it's outside of tags, but there are too many quotes and
345 ("[\"']" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0)))) 345 ;; the resulting number of calls to syntax-ppss made it too slow
346 (goto-char (match-end 0))) 346 ;; (bug#33887), so we're now careful to leave alone any pair
347 (string-to-syntax "."))))))) 347 ;; of quotes that doesn't hold a < or > char, which is the vast majority.
348 ("\\(?:\\(1:\"\\)[^\"<>]*[<>\"]\\|\\(1:'\\)[^'<>]*[<>']\\)"
349 (1 (unless (memq (char-before) '(?\' ?\"))
350 ;; Be careful to call `syntax-ppss' on a position before the one
351 ;; we're going to change, so as not to need to flush the data we
352 ;; just computed.
353 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
354 (goto-char (1- (match-end 0))))
355 (string-to-syntax ".")))))
356 )))
348 357
349(defun sgml-syntax-propertize (start end) 358(defun sgml-syntax-propertize (start end)
350 "Syntactic keywords for `sgml-mode'." 359 "Syntactic keywords for `sgml-mode'."