public
Fork of technomancy/emacs-starter-kit
Description: All the code you need to get started, with an emphasis on dynamic languages.
Homepage:
Clone URL: git://github.com/topfunky/emacs-starter-kit.git
emacs-starter-kit / starter-kit-js.el
100644 34 lines (27 sloc) 1.127 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;;; starter-kit-js.el --- Some helpful Javascript helpers
;;
;; Part of the Emacs Starter Kit
 
(eval-after-load 'js2-mode
  '(progn
 
     ;; Cosmetics
     (font-lock-add-keywords
      'js2-mode `(("\\(function *\\)("
                   (0 (progn (compose-region (match-beginning 1) (match-end 1)
                                             "ƒ")
                             nil)))))
 
     (font-lock-add-keywords
      'js2-mode
      '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):"
         1 font-lock-warning-face t)))
 
     (defun js-lambda () (interactive) (insert "function () {\n}")
       (backward-char 5))
 
     (define-key js2-mode-map (kbd "C-c l") 'js-lambda)
     (define-key js2-mode-map "\C-\M-h" 'backward-kill-word)
     (define-key js2-mode-map (kbd "TAB") (lambda () (interactive)
                                            (indent-for-tab-command)
                                            (back-to-indentation)))
 
     (add-hook 'js2-mode-hook 'coding-hook)
     (setq js2-bounce-indent-flag nil
           js2-indent-on-enter-key t)))
 
(provide 'starter-kit-js)
;;; starter-kit-js.el ends here