diff options
author | Noam Postavsky <npostavs@gmail.com> | 2019-05-15 18:51:30 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2019-05-15 19:04:14 -0400 |
commit | e7e92dc5d24ac3bcde69732bab6a6c3c0d9de97b (patch) | |
tree | b84c65ba64a40bf9f94787f56b8f939c8a938374 /lisp/textmodes/sgml-mode.el | |
parent | 520aca2d890a051621b730b0a7e97dd07a546df4 (diff) | |
download | emacs-e7e92dc5d24ac3bcde69732bab6a6c3c0d9de97b.tar.gz emacs-e7e92dc5d24ac3bcde69732bab6a6c3c0d9de97b.tar.bz2 emacs-e7e92dc5d24ac3bcde69732bab6a6c3c0d9de97b.zip |
Fix merge of sgml-syntax-propertize-rules
During the merge of emacs-26, the sgml-syntax-propertize-rules part of
2019-01-17 "* lisp/textmodes/sgml-mode.el: Try and fix bug#33887." got
lost in the conflict against 2019-05-09 "Recognize single quote
attribute values in nxml and sgml (Bug#35381)".
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-rules): Reapply
the 2019-01-17 change to speed up sgml-syntax-propertize-rules, taking
into account the 2019-05-09 which means we have to handle single
quotes as well.
Diffstat (limited to 'lisp/textmodes/sgml-mode.el')
-rw-r--r-- | lisp/textmodes/sgml-mode.el | 21 |
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.") ("--[ \t\n]*\\(>\\)" (1 "> b")) ("\\(<\\)[?!]" (1 (prog1 "|>" (sgml-syntax-propertize-inside end)))) - ;; Quotes outside of tags should not introduce strings. - ;; Be careful to call `syntax-ppss' on a position before the one we're - ;; going to change, so as not to need to flush the data we just computed. - ("[\"']" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0)))) - (goto-char (match-end 0))) - (string-to-syntax "."))))))) + ;; Quotes outside of tags should not introduce strings which end up + ;; hiding tags. We used to test every quote and mark it as "." + ;; 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. + ("\\(?:\\(1:\"\\)[^\"<>]*[<>\"]\\|\\(1:'\\)[^'<>]*[<>']\\)" + (1 (unless (memq (char-before) '(?\' ?\")) + ;; Be careful to call `syntax-ppss' on a position before the one + ;; we're going to change, so as not to need to flush the data we + ;; just computed. + (if (prog1 (zerop (car (syntax-ppss (match-beginning 0)))) + (goto-char (1- (match-end 0)))) + (string-to-syntax "."))))) + ))) (defun sgml-syntax-propertize (start end) "Syntactic keywords for `sgml-mode'." |