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