Skip to content

Latest commit

 

History

History
44 lines (38 loc) · 1.39 KB

starter-kit-js.org

File metadata and controls

44 lines (38 loc) · 1.39 KB

Starter Kit JS

This is part of the Emacs Starter Kit.

Starter Kit JS

Java-script Helpers

(font-lock-add-keywords
 'espresso-mode `(("\\(function *\\)("
                   (0 (progn (compose-region (match-beginning 1) (match-end 1)
                                             "ƒ")
                             nil)))))
(font-lock-add-keywords 'espresso-mode
                        '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):"
                           1 font-lock-warning-face t)))
(autoload 'espresso-mode "espresso" "Start espresso-mode" t)
(add-to-list 'auto-mode-alist '("\\.js$" . espresso-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . espresso-mode))
(add-hook 'espresso-mode-hook 'moz-minor-mode)
(add-hook 'espresso-mode-hook 'turn-on-paredit)
(add-hook 'espresso-mode-hook 'run-starter-kit-coding-hook)
;; (add-hook 'espresso-mode-hook 'idle-highlight)
(setq espresso-indent-level 2)
(defun starter-kit-pp-json ()
  "Pretty-print the json object following point."
  (interactive)
  (require 'json)
  (let ((json-object (save-excursion (json-read))))
    (switch-to-buffer "*json*")
    (delete-region (point-min) (point-max))
    (insert (pp json-object))
    (goto-char (point-min))))