From: Jackson Ray Hamilton Date: Tue, 4 Jun 2019 15:23:11 +0000 (-0700) Subject: Revert "Add extra text property to fix issue with js2-mode integration" X-Git-Tag: emacs-27.0.90~2699 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c4214e4dc19a40ebe22ea4db09ae3f8dd64a9143;p=emacs.git Revert "Add extra text property to fix issue with js2-mode integration" This reverts commit 382a508ed21e4f12ace9f8871818e25235e8f05e. We ended up deciding against using this in js2-mode. Instead, js2-mode may eventually use js-mode’s syntax-propertize-function to set syntax-table text properties. --- diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 585612eee0b..9a077b99a46 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -2140,14 +2140,6 @@ JSXElement or a JSXOpeningElement/JSXClosingElement pair." ;; `syntax-propertize-rules' loop so the next JSXBoundaryElement can ;; be parsed, if any, be it an opening or closing one. -(defun js-jsx--put-syntax-table (start end value) - "Set syntax-table text property from START to END as VALUE. -Redundantly set the value to two properties, syntax-table and -js-jsx-syntax-table. Derivative modes that remove syntax-table -text properties may recover the value from the second property." ; i.e. js2-mode - (add-text-properties start end (list 'syntax-table value - 'js-jsx-syntax-table value))) - (defun js-jsx--text-range (beg end) "Identify JSXText within a “>/{/}/<” pair." (when (> (- end beg) 0) @@ -2159,7 +2151,7 @@ text properties may recover the value from the second property." ; i.e. js2-mode ;; negate those roles. (when (or (= (char-after) ?/) ; comment (= (syntax-class (syntax-after (point))) 7)) ; string quote - (js-jsx--put-syntax-table (point) (1+ (point)) '(1))) + (put-text-property (point) (1+ (point)) 'syntax-table '(1))) (forward-char))) ;; Mark JSXText so it can be font-locked as non-keywords. (put-text-property beg (1+ beg) 'js-jsx-text (list beg end (current-buffer))) @@ -2228,7 +2220,7 @@ testing for syntax only valid as JSX." (cond ((= (char-after) ?>) ;; Make the closing “>” a close parenthesis. - (js-jsx--put-syntax-table (point) (1+ (point)) '(5)) + (put-text-property (point) (1+ (point)) 'syntax-table '(5)) (forward-char) (setq unambiguous t) (throw 'stop nil)) @@ -2314,7 +2306,7 @@ testing for syntax only valid as JSX." ;; Save JSXBoundaryElement’s name’s match data for font-locking. (if name-beg (put-text-property name-beg (1+ name-beg) 'js-jsx-tag-name name-match-data)) ;; Make the opening “<” an open parenthesis. - (js-jsx--put-syntax-table tag-beg (1+ tag-beg) '(4)) + (put-text-property tag-beg (1+ tag-beg) 'syntax-table '(4)) ;; Prevent “out of range” errors when typing at the end of a buffer. (setq tag-end (if (eobp) (1- (point)) (point))) ;; Mark beginning and end of tag for font-locking. @@ -2333,8 +2325,7 @@ testing for syntax only valid as JSX." (list 'js-jsx-tag-beg nil 'js-jsx-tag-end nil 'js-jsx-close-tag-pos nil 'js-jsx-tag-name nil 'js-jsx-attribute-name nil 'js-jsx-string nil - 'js-jsx-text nil 'js-jsx-expr nil 'js-jsx-expr-attribute nil - 'js-jsx-syntax-table nil) + 'js-jsx-text nil 'js-jsx-expr nil 'js-jsx-expr-attribute nil) "Plist of text properties added by `js-syntax-propertize'.") (defun js-syntax-propertize (start end)