Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add support for Cygwin-style absolute paths, which makes using the fi…

…le compilation feature of CoffeeScript mode possible on Windows systems where Node.js is compiled with Cygwin
  • Loading branch information...
commit 2d489a8dcd54fd6adfd97d1ea0fd6160768d7a27 1 parent 27df14a
Daniel Gregoire authored August 04, 2011

Showing 1 changed file with 19 additions and 1 deletion. Show diff stats Hide diff stats

  1. 20  coffee-mode.el
20  coffee-mode.el
@@ -109,6 +109,16 @@ path."
109 109
   :type 'list
110 110
   :group 'coffee)
111 111
 
  112
+(defcustom coffee-cygwin-mode t
  113
+  "For Windows systems, add support for Cygwin-style absolute paths."
  114
+  :type 'boolean
  115
+  :group 'coffee)
  116
+
  117
+(defcustom coffee-cygwin-prefix "/cygdrive/C"
  118
+  "The prefix with which to replace the drive-letter for your Windows partition, e.g. 'C:' would be replaced by '/c/cygdrive'."
  119
+  :type 'string
  120
+  :group 'coffee)
  121
+
112 122
 (defcustom coffee-compiled-buffer-name "*coffee-compiled*"
113 123
   "The name of the scratch buffer used when compiling CoffeeScript."
114 124
   :type 'string
@@ -315,9 +325,17 @@ For detail, see `comment-dwim'."
315 325
   (let ((deactivate-mark nil) (comment-start "#") (comment-end ""))
316 326
     (comment-dwim arg)))
317 327
 
  328
+(defun coffee-cygwin-path (expanded-file-name)
  329
+  "Given an expanded file name, derive the absolute Cygwin path based on `coffee-cygwin-prefix'."
  330
+  (replace-regexp-in-string "^[a-zA-Z]:" coffee-cygwin-prefix expanded-file-name t))
  331
+
318 332
 (defun coffee-command-compile (file-name)
319 333
   "The `coffee-command' with args to compile a file."
320  
-  (mapconcat 'identity (append (list coffee-command) coffee-args-compile (list file-name)) " "))
  334
+  (let ((full-file-name (if (and (equal system-type 'windows-nt)
  335
+                                 coffee-cygwin-mode)
  336
+                            (coffee-cygwin-path (expand-file-name file-name))
  337
+			  (expand-file-name file-name))))
  338
+    (mapconcat 'identity (append (list coffee-command) coffee-args-compile (list full-file-name)) " ")))
321 339
 
322 340
 ;;
323 341
 ;; imenu support

0 notes on commit 2d489a8

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