From: Stefan Monnier Date: Fri, 5 Aug 2011 19:53:46 +0000 (-0400) Subject: * lisp/progmodes/js.el (js--regexp-literal): Accept regexps at the beginning X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~86^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4640dd881c07162a6120ccb3b117b748badf78c9;p=emacs.git * lisp/progmodes/js.el (js--regexp-literal): Accept regexps at the beginning of statements and in a few more cases. Fixes: debbugs:9183 --- 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