Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

documentation

  • Loading branch information...
commit 4a11c70fedd959a02c19b23007b31bc0c6bb57be 1 parent 76748c1
@defunkt authored
Showing with 120 additions and 2 deletions.
  1. +75 −0 README.md
  2. +45 −2 coffee-mode.el
View
75 README.md
@@ -0,0 +1,75 @@
+CoffeeScript Major Mode
+=======================
+
+An Emacs major mode for [CoffeeScript][cs], unfancy JavaScript.
+
+Provides syntax highlight by way of font-lock, basic indentation, and
+a few cute commands.
+
+## Installation
+
+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)
+
+`coffe-mode` will be enabled automatically for any files ending in
+".coffee".
+
+## Commands
+
+### coffee-compile-buffer
+
+Compiles the current buffer to JavaScript using the command specified
+by the `coffee-command` variable and opens the contents in a new
+buffer using your JavaScript mode of choice. The JavaScript mode is
+determined by the `coffee-js-mode` variable and defaults to `js2-mode`.
+
+Bind it:
+
+ (define-key coffee-mode-map [(meta r)] 'coffee-compile-buffer)
+
+### coffee-compiler-region
+
+Compiles the selected region to JavaScript using the same
+configuration variables as `coffee-compile-buffer`.
+
+Bind it:
+
+ (define-key coffee-mode-map [(meta R)] 'coffee-compile-region)
+
+### coffee-repl
+
+Starts a repl in a new buffer using `coffee-command`.
+
+## Hooks
+
+### coffee-mode-hook
+
+Naturally. Example:
+
+ (defun coffee-custom ()
+ "coffee-mode-hook"
+ (setq coffee-command "~/dev/coffee))
+
+ (add-hook coffee-mode-hook
+ '(lambda() (coffee-custom)))
+
+## Thanks
+
+* <http://xahlee.org/emacs/elisp_syntax_coloring.html> for instructions.
+* Jason Blevins for the guidance his markdown-mode.el gave.
+
+## Bugs
+
+It's tested on Aquamacs 1.9 (Emacs 22) for OS X Snow Leopard so it may
+not work on your environment. Please file a bug at
+<http://github.com/defunkt/coffee-mode/issues> and maybe we can fix
+the problem.
+
+[cs]: http://jashkenas.github.com/coffee-script/
View
47 coffee-mode.el
@@ -1,7 +1,50 @@
-;;
+;;; coffee-mode.el --- Major mode to edit CoffeeScript files in Emacs
+
+;; Copyright (C) 2010 Chris Wanstrath
+
+;; Version 0.1.0
+;; Keywords: CoffeeScript major mode
+;; Author: Chris Wanstrath <chris@ozmm.org>
+;; URL: http://github.com/defunkt/coffee-script
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary
+
+;; For commentary please see the README.md or
+;; http://github.com/defunkt/coffee-mode#readme
+
+;;; Installation
+
+;; 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)
+
+;;; Thanks
+
;; Major thanks to http://xahlee.org/emacs/elisp_syntax_coloring.html
;; the instructions.
-;;
+
;; Also thanks to Jason Blevins's markdown-mode.el for guidance.
(require 'easymenu)
Please sign in to comment.
Something went wrong with that request. Please try again.