[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ea09b9f 2/2: Specify the matching chars for JSX ope
From: |
Jackson Ray Hamilton |
Subject: |
[Emacs-diffs] master ea09b9f 2/2: Specify the matching chars for JSX open/close parenthesis |
Date: |
Tue, 4 Jun 2019 12:06:04 -0400 (EDT) |
branch: master
commit ea09b9fe34d2d715bf72a25e3f69ae2baff0b89c
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
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.
---
lisp/progmodes/js.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 9a077b9..161fd5c 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -2220,7 +2220,8 @@ testing for syntax only valid as JSX."
(cond
((= (char-after) ?>)
;; Make the closing “>” a close parenthesis.
- (put-text-property (point) (1+ (point)) 'syntax-table '(5))
+ (put-text-property (point) (1+ (point)) 'syntax-table
+ (eval-when-compile (string-to-syntax ")<")))
(forward-char)
(setq unambiguous t)
(throw 'stop nil))
@@ -2306,7 +2307,8 @@ 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.
- (put-text-property tag-beg (1+ tag-beg) 'syntax-table '(4))
+ (put-text-property tag-beg (1+ tag-beg) 'syntax-table
+ (eval-when-compile (string-to-syntax "(>")))
;; 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.