diff options
| author | Jackson Ray Hamilton | 2019-06-04 08:23:11 -0700 |
|---|---|---|
| committer | Jackson Ray Hamilton | 2019-06-04 09:05:30 -0700 |
| commit | c4214e4dc19a40ebe22ea4db09ae3f8dd64a9143 (patch) | |
| tree | bb03bae4fc4014b2ffd7fe68cdc15515412ab7a8 | |
| parent | 88d440181e2f38947a8211512c375a4fb5182e61 (diff) | |
| download | emacs-c4214e4dc19a40ebe22ea4db09ae3f8dd64a9143.tar.gz emacs-c4214e4dc19a40ebe22ea4db09ae3f8dd64a9143.zip | |
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.
| -rw-r--r-- | lisp/progmodes/js.el | 17 |
1 files changed, 4 insertions, 13 deletions
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." | |||
| 2140 | ;; `syntax-propertize-rules' loop so the next JSXBoundaryElement can | 2140 | ;; `syntax-propertize-rules' loop so the next JSXBoundaryElement can |
| 2141 | ;; be parsed, if any, be it an opening or closing one. | 2141 | ;; be parsed, if any, be it an opening or closing one. |
| 2142 | 2142 | ||
| 2143 | (defun js-jsx--put-syntax-table (start end value) | ||
| 2144 | "Set syntax-table text property from START to END as VALUE. | ||
| 2145 | Redundantly set the value to two properties, syntax-table and | ||
| 2146 | js-jsx-syntax-table. Derivative modes that remove syntax-table | ||
| 2147 | text properties may recover the value from the second property." ; i.e. js2-mode | ||
| 2148 | (add-text-properties start end (list 'syntax-table value | ||
| 2149 | 'js-jsx-syntax-table value))) | ||
| 2150 | |||
| 2151 | (defun js-jsx--text-range (beg end) | 2143 | (defun js-jsx--text-range (beg end) |
| 2152 | "Identify JSXText within a “>/{/}/<” pair." | 2144 | "Identify JSXText within a “>/{/}/<” pair." |
| 2153 | (when (> (- end beg) 0) | 2145 | (when (> (- end beg) 0) |
| @@ -2159,7 +2151,7 @@ text properties may recover the value from the second property." ; i.e. js2-mode | |||
| 2159 | ;; negate those roles. | 2151 | ;; negate those roles. |
| 2160 | (when (or (= (char-after) ?/) ; comment | 2152 | (when (or (= (char-after) ?/) ; comment |
| 2161 | (= (syntax-class (syntax-after (point))) 7)) ; string quote | 2153 | (= (syntax-class (syntax-after (point))) 7)) ; string quote |
| 2162 | (js-jsx--put-syntax-table (point) (1+ (point)) '(1))) | 2154 | (put-text-property (point) (1+ (point)) 'syntax-table '(1))) |
| 2163 | (forward-char))) | 2155 | (forward-char))) |
| 2164 | ;; Mark JSXText so it can be font-locked as non-keywords. | 2156 | ;; Mark JSXText so it can be font-locked as non-keywords. |
| 2165 | (put-text-property beg (1+ beg) 'js-jsx-text (list beg end (current-buffer))) | 2157 | (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." | |||
| 2228 | (cond | 2220 | (cond |
| 2229 | ((= (char-after) ?>) | 2221 | ((= (char-after) ?>) |
| 2230 | ;; Make the closing “>” a close parenthesis. | 2222 | ;; Make the closing “>” a close parenthesis. |
| 2231 | (js-jsx--put-syntax-table (point) (1+ (point)) '(5)) | 2223 | (put-text-property (point) (1+ (point)) 'syntax-table '(5)) |
| 2232 | (forward-char) | 2224 | (forward-char) |
| 2233 | (setq unambiguous t) | 2225 | (setq unambiguous t) |
| 2234 | (throw 'stop nil)) | 2226 | (throw 'stop nil)) |
| @@ -2314,7 +2306,7 @@ testing for syntax only valid as JSX." | |||
| 2314 | ;; Save JSXBoundaryElement’s name’s match data for font-locking. | 2306 | ;; Save JSXBoundaryElement’s name’s match data for font-locking. |
| 2315 | (if name-beg (put-text-property name-beg (1+ name-beg) 'js-jsx-tag-name name-match-data)) | 2307 | (if name-beg (put-text-property name-beg (1+ name-beg) 'js-jsx-tag-name name-match-data)) |
| 2316 | ;; Make the opening “<” an open parenthesis. | 2308 | ;; Make the opening “<” an open parenthesis. |
| 2317 | (js-jsx--put-syntax-table tag-beg (1+ tag-beg) '(4)) | 2309 | (put-text-property tag-beg (1+ tag-beg) 'syntax-table '(4)) |
| 2318 | ;; Prevent “out of range” errors when typing at the end of a buffer. | 2310 | ;; Prevent “out of range” errors when typing at the end of a buffer. |
| 2319 | (setq tag-end (if (eobp) (1- (point)) (point))) | 2311 | (setq tag-end (if (eobp) (1- (point)) (point))) |
| 2320 | ;; Mark beginning and end of tag for font-locking. | 2312 | ;; Mark beginning and end of tag for font-locking. |
| @@ -2333,8 +2325,7 @@ testing for syntax only valid as JSX." | |||
| 2333 | (list | 2325 | (list |
| 2334 | 'js-jsx-tag-beg nil 'js-jsx-tag-end nil 'js-jsx-close-tag-pos nil | 2326 | 'js-jsx-tag-beg nil 'js-jsx-tag-end nil 'js-jsx-close-tag-pos nil |
| 2335 | 'js-jsx-tag-name nil 'js-jsx-attribute-name nil 'js-jsx-string nil | 2327 | 'js-jsx-tag-name nil 'js-jsx-attribute-name nil 'js-jsx-string nil |
| 2336 | 'js-jsx-text nil 'js-jsx-expr nil 'js-jsx-expr-attribute nil | 2328 | 'js-jsx-text nil 'js-jsx-expr nil 'js-jsx-expr-attribute nil) |
| 2337 | 'js-jsx-syntax-table nil) | ||
| 2338 | "Plist of text properties added by `js-syntax-propertize'.") | 2329 | "Plist of text properties added by `js-syntax-propertize'.") |
| 2339 | 2330 | ||
| 2340 | (defun js-syntax-propertize (start end) | 2331 | (defun js-syntax-propertize (start end) |