diff options
| author | Jackson Ray Hamilton | 2019-06-04 08:37:36 -0700 |
|---|---|---|
| committer | Jackson Ray Hamilton | 2019-06-04 09:05:40 -0700 |
| commit | ea09b9fe34d2d715bf72a25e3f69ae2baff0b89c (patch) | |
| tree | b5f92b93bd438f60220351bbd9d1a399ce41923b | |
| parent | c4214e4dc19a40ebe22ea4db09ae3f8dd64a9143 (diff) | |
| download | emacs-ea09b9fe34d2d715bf72a25e3f69ae2baff0b89c.tar.gz emacs-ea09b9fe34d2d715bf72a25e3f69ae2baff0b89c.zip | |
Specify the matching chars for JSX open/close parenthesis
* lisp/progmodes/js.el (js-jsx--syntax-propertize-tag): Indicate the
matching parenthesis character (since JSX’s < and > aren’t typical
parenthesis) for the sake of packages like rainbow-delimiters which
need that information.
| -rw-r--r-- | lisp/progmodes/js.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 9a077b99a46..161fd5c00b0 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -2220,7 +2220,8 @@ testing for syntax only valid as JSX." | |||
| 2220 | (cond | 2220 | (cond |
| 2221 | ((= (char-after) ?>) | 2221 | ((= (char-after) ?>) |
| 2222 | ;; Make the closing “>” a close parenthesis. | 2222 | ;; Make the closing “>” a close parenthesis. |
| 2223 | (put-text-property (point) (1+ (point)) 'syntax-table '(5)) | 2223 | (put-text-property (point) (1+ (point)) 'syntax-table |
| 2224 | (eval-when-compile (string-to-syntax ")<"))) | ||
| 2224 | (forward-char) | 2225 | (forward-char) |
| 2225 | (setq unambiguous t) | 2226 | (setq unambiguous t) |
| 2226 | (throw 'stop nil)) | 2227 | (throw 'stop nil)) |
| @@ -2306,7 +2307,8 @@ testing for syntax only valid as JSX." | |||
| 2306 | ;; Save JSXBoundaryElement’s name’s match data for font-locking. | 2307 | ;; Save JSXBoundaryElement’s name’s match data for font-locking. |
| 2307 | (if name-beg (put-text-property name-beg (1+ name-beg) 'js-jsx-tag-name name-match-data)) | 2308 | (if name-beg (put-text-property name-beg (1+ name-beg) 'js-jsx-tag-name name-match-data)) |
| 2308 | ;; Make the opening “<” an open parenthesis. | 2309 | ;; Make the opening “<” an open parenthesis. |
| 2309 | (put-text-property tag-beg (1+ tag-beg) 'syntax-table '(4)) | 2310 | (put-text-property tag-beg (1+ tag-beg) 'syntax-table |
| 2311 | (eval-when-compile (string-to-syntax "(>"))) | ||
| 2310 | ;; Prevent “out of range” errors when typing at the end of a buffer. | 2312 | ;; Prevent “out of range” errors when typing at the end of a buffer. |
| 2311 | (setq tag-end (if (eobp) (1- (point)) (point))) | 2313 | (setq tag-end (if (eobp) (1- (point)) (point))) |
| 2312 | ;; Mark beginning and end of tag for font-locking. | 2314 | ;; Mark beginning and end of tag for font-locking. |