Skip to content

Commit

Permalink
make a single hook that gets run from whichever javascript mode is used
Browse files Browse the repository at this point in the history
  • Loading branch information
stesla committed Aug 26, 2011
1 parent b7bce7b commit 05390ef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion starter-kit-js.el
Expand Up @@ -5,6 +5,10 @@
;; NB: js-mode is part of Emacs since version 23.2 (with an alias
;; javascript-mode). It is derived and updated from Espresso mode.

(defvar esk-js-mode-hook nil)
(defun run-esk-js-mode-hook ()
(run-hooks 'esk-js-mode-hook))

(defmacro esk-configure-javascript (name)
(let ((sym (intern name))
(mode (intern (concat name "-mode")))
Expand All @@ -18,7 +22,8 @@
(add-hook ',hook 'moz-minor-mode)
(add-hook ',hook 'esk-paredit-nonlisp)
(add-hook ',hook 'run-coding-hook)
(add-hook ',hook 'pretty-functions) (setq ,indent 2)
(add-hook ',hook 'run-esk-js-mode-hook)
(setq ,indent 2)

(eval-after-load ',sym
'(progn (define-key ,keymap "{" 'paredit-open-curly)
Expand All @@ -31,6 +36,7 @@
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "ƒ")
nil))))))
(add-hook 'esk-js-mode-hook 'pretty-functions)

(if (< (string-to-number emacs-version) 23.2)
(esk-configure-javascript "espresso")
Expand Down

0 comments on commit 05390ef

Please sign in to comment.