aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2016-05-04 08:53:00 -0400
committerStefan Monnier2016-05-04 08:53:00 -0400
commit4deb5bd9b1d400b9f932053eb6900e5700414ce8 (patch)
treee7637b689d9e0fcb92367f4ea08370f325cdceee
parent9ec81c5a6e12d9fec56767307d6072546b5a4dc2 (diff)
downloademacs-4deb5bd9b1d400b9f932053eb6900e5700414ce8.tar.gz
emacs-4deb5bd9b1d400b9f932053eb6900e5700414ce8.zip
* lisp/progmodes/js.el (js-syntax-propertize): Recognize shebang line.
-rw-r--r--lisp/progmodes/js.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 48eb3e778e1..9265e38e4bc 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1722,7 +1722,8 @@ This performs fontification according to `js--class-styles'."
1722 (eval-when-compile (append "=({[,:;" '(nil)))))) 1722 (eval-when-compile (append "=({[,:;" '(nil))))))
1723 (put-text-property (match-beginning 1) (match-end 1) 1723 (put-text-property (match-beginning 1) (match-end 1)
1724 'syntax-table (string-to-syntax "\"/")) 1724 'syntax-table (string-to-syntax "\"/"))
1725 (js-syntax-propertize-regexp end)))))) 1725 (js-syntax-propertize-regexp end)))))
1726 ("\\`\\(#\\)!" (1 "< b")))
1726 (point) end)) 1727 (point) end))
1727 1728
1728(defconst js--prettify-symbols-alist 1729(defconst js--prettify-symbols-alist
@@ -2248,7 +2249,7 @@ i.e., customize JSX element indentation with `sgml-basic-offset',
2248 "Fill the paragraph with `c-fill-paragraph'." 2249 "Fill the paragraph with `c-fill-paragraph'."
2249 (interactive "*P") 2250 (interactive "*P")
2250 (let ((js--filling-paragraph t) 2251 (let ((js--filling-paragraph t)
2251 (fill-paragraph-function 'c-fill-paragraph)) 2252 (fill-paragraph-function #'c-fill-paragraph))
2252 (c-fill-paragraph justify))) 2253 (c-fill-paragraph justify)))
2253 2254
2254;;; Type database and Imenu 2255;;; Type database and Imenu
@@ -3495,6 +3496,7 @@ browser, respectively."
3495 3496
3496 3497
3497 (unwind-protect 3498 (unwind-protect
3499 ;; FIXME: Don't impose IDO on the user.
3498 (setq selected-tab-cname 3500 (setq selected-tab-cname
3499 (let ((ido-minibuffer-setup-hook 3501 (let ((ido-minibuffer-setup-hook
3500 (cons #'setup-hook ido-minibuffer-setup-hook))) 3502 (cons #'setup-hook ido-minibuffer-setup-hook)))
@@ -3717,11 +3719,11 @@ If one hasn't been set, or if it's stale, prompt for a new one."
3717(define-derived-mode js-mode prog-mode "JavaScript" 3719(define-derived-mode js-mode prog-mode "JavaScript"
3718 "Major mode for editing JavaScript." 3720 "Major mode for editing JavaScript."
3719 :group 'js 3721 :group 'js
3720 (setq-local indent-line-function 'js-indent-line) 3722 (setq-local indent-line-function #'js-indent-line)
3721 (setq-local beginning-of-defun-function 'js-beginning-of-defun) 3723 (setq-local beginning-of-defun-function #'js-beginning-of-defun)
3722 (setq-local end-of-defun-function 'js-end-of-defun) 3724 (setq-local end-of-defun-function #'js-end-of-defun)
3723 (setq-local open-paren-in-column-0-is-defun-start nil) 3725 (setq-local open-paren-in-column-0-is-defun-start nil)
3724 (setq-local font-lock-defaults (list js--font-lock-keywords)) 3726 (setq-local font-lock-defaults '(js--font-lock-keywords))
3725 (setq-local syntax-propertize-function #'js-syntax-propertize) 3727 (setq-local syntax-propertize-function #'js-syntax-propertize)
3726 (setq-local prettify-symbols-alist js--prettify-symbols-alist) 3728 (setq-local prettify-symbols-alist js--prettify-symbols-alist)
3727 3729
@@ -3732,7 +3734,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
3732 ;; Comments 3734 ;; Comments
3733 (setq-local comment-start "// ") 3735 (setq-local comment-start "// ")
3734 (setq-local comment-end "") 3736 (setq-local comment-end "")
3735 (setq-local fill-paragraph-function 'js-c-fill-paragraph) 3737 (setq-local fill-paragraph-function #'js-c-fill-paragraph)
3736 3738
3737 ;; Parse cache 3739 ;; Parse cache
3738 (add-hook 'before-change-functions #'js--flush-caches t t) 3740 (add-hook 'before-change-functions #'js--flush-caches t t)