Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add functions to send buffer, region and line to the CoffeeREPL buffer.

  • Loading branch information...
commit 075b1ce23b702fc2214de6d19122e6e6bda144f3 1 parent c45c5f7
Tim McGilchrist authored June 25, 2012

Showing 1 changed file with 18 additions and 2 deletions. Show diff stats Hide diff stats

  1. 20  coffee-mode.el
20  coffee-mode.el
@@ -128,7 +128,6 @@ with CoffeeScript."
128 128
 ;;
129 129
 ;; Commands
130 130
 ;;
131  
-
132 131
 (defun coffee-repl ()
133 132
   "Launch a CoffeeScript REPL using `coffee-command' as an inferior mode."
134 133
   (interactive)
@@ -137,7 +136,6 @@ with CoffeeScript."
137 136
     (set-buffer
138 137
      (apply 'make-comint "CoffeeREPL"
139 138
             coffee-command nil coffee-args-repl)))
140  
-
141 139
   (pop-to-buffer "*CoffeeREPL*"))
142 140
 
143 141
 (defun coffee-compiled-file-name (&optional filename)
@@ -183,6 +181,24 @@ called `coffee-compiled-buffer-name'."
183 181
   (let ((buffer-file-name "tmp.js")) (set-auto-mode))
184 182
   (goto-char (point-min)))
185 183
 
  184
+(defun coffee-send-line (start end)
  185
+  "Send the current line to the inferior Coffee process"
  186
+  (interactive "r")
  187
+  (send-region "*CoffeeREPL*" (line-beginning-position) (line-end-position))
  188
+  (send-string "*CoffeeREPL*" "\n"))
  189
+
  190
+(defun coffee-send-region (start end)
  191
+  "Send the current region to the inferior Coffee process."
  192
+  (interactive "r")
  193
+  (send-region "*CoffeeREPL*" start end)
  194
+  (send-string "*CoffeeREPL*" "\n"))
  195
+
  196
+(defun coffee-send-buffer ()
  197
+  "Send the current buffer to the inferior Coffee process."
  198
+  (interactive "r")
  199
+  (send-region "*CoffeeREPL*" point-min point-max)
  200
+  (send-string "*CoffeeREPL*" "\n"))
  201
+
186 202
 (defun coffee-js2coffee-replace-region (start end)
187 203
   "Convert JavaScript in the region into CoffeeScript."
188 204
   (interactive "r")

0 notes on commit 075b1ce

Please sign in to comment.
Something went wrong with that request. Please try again.