summaryrefslogtreecommitdiff
path: root/lisp/progmodes/js.el
diff options
context:
space:
mode:
authorK. Handa <handa@gnu.org>2015-09-27 17:06:12 +0900
committerK. Handa <handa@gnu.org>2015-09-27 17:06:12 +0900
commit52beda922d2cb523a03661bf74b8678c8b45e440 (patch)
tree04617b37298746a61d5324a5b35c9b71f439d762 /lisp/progmodes/js.el
parent94ed5167557112fb00eeca05e62589db744206de (diff)
parent1ac5a9c20cb22efb398fa18781c6b932dd4e54df (diff)
downloademacs-52beda922d2cb523a03661bf74b8678c8b45e440.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.el34
1 files changed, 16 insertions, 18 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 98a22dd8441..ab994f38252 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -126,7 +126,7 @@ An example of this is \"Class.prototype = { method1: ...}\".")
(defconst js--prototype-objextend-class-decl-re-2
(concat "^\\s-*\\(?:var\\s-+\\)?"
"\\(" js--dotted-name-re "\\)"
- "\\s-*=\\s-*Object\\.extend\\s-*\("))
+ "\\s-*=\\s-*Object\\.extend\\s-*("))
;; var NewClass = Class.create({
(defconst js--prototype-class-decl-re
@@ -639,7 +639,7 @@ enabled frameworks."
(js--maybe-join
"\\(?:var[ \t]+\\)?[a-zA-Z_$0-9.]+[ \t]*=[ \t]*\\(?:"
"\\|"
- "\\)[ \t]*\("
+ "\\)[ \t]*("
(when (memq 'prototype js-enabled-frameworks)
"Class\\.create")
@@ -651,10 +651,10 @@ enabled frameworks."
"[a-zA-Z_$0-9]+\\.extend\\(?:Final\\)?"))
(when (memq 'dojo js-enabled-frameworks)
- "dojo\\.declare[ \t]*\(")
+ "dojo\\.declare[ \t]*(")
(when (memq 'mochikit js-enabled-frameworks)
- "MochiKit\\.Base\\.update[ \t]*\(")
+ "MochiKit\\.Base\\.update[ \t]*(")
;; mumble.prototypeTHING
(js--maybe-join
@@ -662,7 +662,7 @@ enabled frameworks."
(when (memq 'javascript js-enabled-frameworks)
'( ;; foo.prototype.bar = function(
- "\\.[a-zA-Z_$0-9]+[ \t]*=[ \t]*function[ \t]*\("
+ "\\.[a-zA-Z_$0-9]+[ \t]*=[ \t]*function[ \t]*("
;; mumble.prototype = {
"[ \t]*=[ \t]*{")))))
@@ -1370,17 +1370,6 @@ LIMIT defaults to point."
(looking-at "\"\\s-*,\\s-*\\[")
(eq (match-end 0) (1+ list-begin)))))))
-(defun js--syntax-begin-function ()
- (when (< js--cache-end (point))
- (goto-char (max (point-min) js--cache-end)))
-
- (let ((pitem))
- (while (and (setq pitem (car (js--backward-pstate)))
- (not (eq 0 (js--pitem-paren-depth pitem)))))
-
- (when pitem
- (goto-char (js--pitem-h-begin pitem )))))
-
;;; Font Lock
(defun js--make-framework-matcher (framework &rest regexps)
"Helper function for building `js--font-lock-keywords'.
@@ -1735,6 +1724,12 @@ This performs fontification according to `js--class-styles'."
(js-syntax-propertize-regexp end))))))
(point) end))
+(defconst js--prettify-symbols-alist
+ '(("=>" . ?⇒)
+ (">=" . ?≥)
+ ("<=" . ?≤))
+ "Alist of symbol prettifications for JavaScript.")
+
;;; Indentation
(defconst js--possibly-braceless-keyword-re
@@ -3506,6 +3501,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
(setq-local open-paren-in-column-0-is-defun-start nil)
(setq-local font-lock-defaults (list js--font-lock-keywords))
(setq-local syntax-propertize-function #'js-syntax-propertize)
+ (setq-local prettify-symbols-alist js--prettify-symbols-alist)
(setq-local parse-sexp-ignore-comments t)
(setq-local parse-sexp-lookup-properties t)
@@ -3550,8 +3546,6 @@ If one hasn't been set, or if it's stale, prompt for a new one."
(make-local-variable 'adaptive-fill-regexp)
(c-setup-paragraph-variables))
- (setq-local syntax-begin-function #'js--syntax-begin-function)
-
;; Important to fontify the whole buffer syntactically! If we don't,
;; then we might have regular expression literals that aren't marked
;; as strings, which will screw up parse-partial-sexp, scan-lists,
@@ -3577,4 +3571,8 @@ If one hasn't been set, or if it's stale, prompt for a new one."
(provide 'js)
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
;; js.el ends here