From 4640dd881c07162a6120ccb3b117b748badf78c9 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 5 Aug 2011 15:53:46 -0400 Subject: [PATCH] * lisp/progmodes/js.el (js--regexp-literal): Accept regexps at the beginning of statements and in a few more cases. Fixes: debbugs:9183 --- lisp/ChangeLog | 3 +++ lisp/progmodes/js.el | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 16ba0d34f02..7c1fa3a656b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2011-08-05 Stefan Monnier + * progmodes/js.el (js--regexp-literal): Accept regexps at the beginning + of statements and in a few more cases (bug#9183). + * emacs-lisp/cl-macs.el (cl--make-usage-var, cl--make-usage-args): New functions. (cl-transform-lambda): Use them (bug#9239). diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 1bdcb4cfa89..4abbe3b895f 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1658,15 +1658,19 @@ This performs fontification according to `js--class-styles'." ;; below. (eval-and-compile (defconst js--regexp-literal - "[=(,:]\\(?:\\s-\\|\n\\)*\\(/\\)\\(?:\\\\.\\|[^/*\\]\\)\\(?:\\\\.\\|[^/\\]\\)*\\(/\\)" + (concat + ;; We want to match regular expressions only at the beginning of + ;; expressions. + ;; FIXME: Should we also allow /regexp/ after infix operators such as +, + ;; /, -, *, >, ...? + "\\(?:\\`\\|[=([{,:;]\\)\\(?:\\s-\\|\n\\)*" + "\\(/\\)\\(?:\\\\.\\|[^/*\\]\\)\\(?:\\\\.\\|[^/\\]\\)*\\(/\\)") "Regexp matching a JavaScript regular expression literal. Match groups 1 and 2 are the characters forming the beginning and end of the literal.")) (defconst js-syntax-propertize-function (syntax-propertize-rules - ;; We want to match regular expressions only at the beginning of - ;; expressions. (js--regexp-literal (1 "\"") (2 "\"")))) ;;; Indentation -- 2.39.2