I've fallen in love with CoffeeScript.
You can use it on the server with node.js (or, presumably, any CommonJS compatible process), or you can use it in the browser.
Say hello to
coffee-mode: An Emacs major mode for CoffeeScript.
It does all the things you want it to.
- Syntax Highlighting
- imenu support (for ⇧⌘T in textmate.el)
- Comment support (
alt-;and ⌘; for me)
- Indentation using
- "Smart" indentation (e.g. hitting
->will indent you properly)
- Menu Bar with links to the documentation for CoffeeScript and node.js.
- Compiles CoffeeScript
A Note on Compilation
If you're using Aquamacs, ⌘r should compile the current
coffee-js-mode and you can override the key combo by
adding this to the
coffee-mode-hook like so:
(defun coffee-custom () "coffee-mode-hook" ;; Emacs key binding (define-key coffee-mode-map [(meta r)] 'coffee-compile-buffer)) (add-hook 'coffee-mode-hook '(lambda () (coffee-custom)))
Make sure you have CoffeeScript 0.5.4 or higher, or change your
coffee-args-compile variables to whatever you
In your shell:
$ cd ~/.emacs.d/vendor $ git clone git://github.com/defunkt/coffee-mode.git
In your emacs config:
(add-to-list 'load-path "~/.emacs.d/vendor/coffee-mode") (require 'coffee-mode)
coffee-mode is not enabled automatically for any files ending in
".coffee" or named "Cakefile", add this to your emacs config as well:
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode)) (add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode))