]> code.delx.au - gnu-emacs-elpa/blobdiff - README.md
Fix missing function `some' issue when loading compiled elisp.
[gnu-emacs-elpa] / README.md
index 5df856af69febab5e5c79b866356f7d4491f6f86..f56882a900010364e7122f46d7d3cdbe05e75d6e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ Well, idiomatic CoffeeScript uses two spaces. We can set our
       "coffee-mode-hook"
      (set (make-local-variable 'tab-width) 2))
 
-    (add-hook coffee-mode-hook
+    (add-hook 'coffee-mode-hook
       '(lambda() (coffee-custom)))
 
 For more configuration options and another example of this hook, look
@@ -163,12 +163,16 @@ Operating on "basic.coffee" and running this command will save a
 "basic.js" in the same directory. Subsequent runs will overwrite the
 file.
 
+If there are compilation errors and we the compiler have returned a
+line number to us for the first error, the point is moved to that
+line, so you can investigate.  If this annoys you, you can set
+`coffee-compile-jump-to-error` to `nil`.
+
 ### 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`.
+buffer using the mode configured for ".js" files.
 
 Bind it:
 
@@ -183,6 +187,20 @@ Bind it:
 
     (define-key coffee-mode-map [(meta R)] 'coffee-compile-region)
 
+### Compile-on-save
+
+Hitting the key sequence `C-c C-o C-s` turns on (toggles) the
+compile-on-save minor mode in `coffee-mode`.  To enable it by default:
+
+    (add-hook 'coffee-mode-hook '(lambda () (coffee-cos-mode t)))
+
+To enable it only if it looks like you may want to:
+
+    (add-hook 'coffee-mode-hook '(lambda ()
+                                   (and (file-exists-p (buffer-file-name))
+                                        (file-exists-p (coffee-compiled-file-name))
+                                        (coffee-cos-mode t))))
+
 ### coffee-repl
 
 Starts a repl in a new buffer using `coffee-command`.
@@ -197,27 +215,24 @@ Naturally. Example:
       "coffee-mode-hook"
 
       ;; CoffeeScript uses two spaces.
-      (set (make-local-variable 'tab-width) 2)
+      (make-local-variable 'tab-width)
+      (set 'tab-width 2)
 
-      ;; If you don't have js2-mode
-      (setq coffee-js-mode 'javascript-mode)
-
-      ;; *Messages* spam
-      (setq coffee-debug-mode t)
+      ;; If you don't want your compiled files to be wrapped
+      (setq coffee-args-compile '("-c" "--bare"))
 
       ;; Emacs key binding
       (define-key coffee-mode-map [(meta r)] 'coffee-compile-buffer)
 
       ;; Riding edge.
-      (setq coffee-command "~/dev/coffee"))
+      (setq coffee-command "~/dev/coffee")
 
-      ;; Compile JS on every save, unless it's a Cakefile.
-      (add-hook 'before-save-hook
-          '(lambda ()
-             (when (not (string= (buffer-name) "Cakefile"))
-              (coffee-compile-file))))
+      ;; Compile '.coffee' files on every save
+      (and (file-exists-p (buffer-file-name))
+           (file-exists-p (coffee-compiled-file-name))
+           (coffee-cos-mode t)))
 
-    (add-hook 'coffee-mode-hook '(lambda () (coffee-custom)))
+    (add-hook 'coffee-mode-hook 'coffee-custom)
 
 ## Configuration
 
@@ -227,24 +242,6 @@ customize-group` with "coffee" as the group.
 You can also customize then with `coffee-mode-hook`, as demonstrated
 above.
 
-### coffee-debug-mode
-
-Whether to run in debug mode or not. Logs to `*Messages*`.
-
-Default: `t`
-
-### coffee-js-mode
-
-The mode to use when viewing compiled JavaScript.
-
-Default: `'js2-mode`
-
-### coffee-cleanup-whitespace
-
-Should we `delete-trailing-whitespace' on save? Probably.
-
-Default: `t`
-
 ### coffee-tab-width
 
 The tab width to use when indenting.
@@ -267,10 +264,9 @@ Default: `'("-i")`
 
 ### coffee-args-compile
 
-The command line arguments to pass to `coffee-command' to get it
-toprint the compiled JavaScript.
+The command line arguments to pass to `coffee-command' when compiling a file.
 
-Default: `'("-s" "-p" "--no-wrap")`
+Default: `'("-c")`
 
 ### coffee-compiled-buffer-name
 
@@ -278,6 +274,15 @@ The name of the scratch buffer used when compiling CoffeeScript.
 
 Default: `"*coffee-compiled*"`
 
+### coffee-compile-jump-to-error
+
+Whether to jump to the first error if compilation fails.  Please note
+that the coffee compiler doesn't always give a line number for the
+issue and in that case it is not possible to jump to the error, of
+course.
+
+Default: `t`
+
 ## Thanks
 
 * Jeremy Ashkenas for CoffeeScript
@@ -290,13 +295,7 @@ Default: `"*coffee-compiled*"`
 Prototype accessor assignments like `String::length: -> 10` don't look
 great.
 
-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.
-
-This is the author's first major mode, so there are probably more
-bugs.
+Please file bugs at <http://github.com/defunkt/coffee-mode/issues>
 
 [cs]: http://jashkenas.github.com/coffee-script/
 [tm]: http://github.com/defunkt/textmate.el