summaryrefslogtreecommitdiff
path: root/lisp/progmodes/js.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2017-04-02 11:03:14 +0200
committerMichael Albinus <michael.albinus@gmx.de>2017-04-02 11:03:14 +0200
commit40a33a3cb711f894ac61691c03cc13e58bc38145 (patch)
tree27fcb032eb04a20bd57b412b2120d357f28ab7fa /lisp/progmodes/js.el
parent59191cd0cbe8463f9095a71cb4048bb138d6e446 (diff)
parenta184a7edc58e1e053aa317a0f162df7e225597e1 (diff)
downloademacs-40a33a3cb711f894ac61691c03cc13e58bc38145.tar.gz
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'lisp/progmodes/js.el')
-rw-r--r--lisp/progmodes/js.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index aed42a85076..3c720c05610 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1713,7 +1713,7 @@ This performs fontification according to `js--class-styles'."
(not (any ?\] ?\\))
(and "\\" not-newline)))
"]")))
- (group "/"))
+ (group (zero-or-one "/")))
"Regular expression matching a JavaScript regexp literal.")
(defun js-syntax-propertize-regexp (end)
@@ -1721,12 +1721,13 @@ This performs fontification according to `js--class-styles'."
(when (eq (nth 3 ppss) ?/)
;; A /.../ regexp.
(goto-char (nth 8 ppss))
- (when (and (looking-at js--syntax-propertize-regexp-regexp)
- ;; Don't touch text after END.
- (<= (match-end 1) end))
- (put-text-property (match-beginning 1) (match-end 1)
+ (when (looking-at js--syntax-propertize-regexp-regexp)
+ ;; Don't touch text after END.
+ (when (> end (match-end 1))
+ (setq end (match-end 1)))
+ (put-text-property (match-beginning 1) end
'syntax-table (string-to-syntax "\"/"))
- (goto-char (match-end 0))))))
+ (goto-char end)))))
(defun js-syntax-propertize (start end)
;; JavaScript allows immediate regular expression objects, written /.../.