defunkt / coffee-mode

Emacs Major Mode for CoffeeScript
http://ozmm.org/posts/coffee_mode.html
574 stars 147 forks source link

version detection failed with version coffee 1.10 #320

Closed crackhopper closed 9 years ago

crackhopper commented 9 years ago

i dived into the code.

when i use coffee with coffee with version 1.10, the below function returns 1.1 which is a wrong result.

(defun coffee--coffeescript-version ()
  (with-temp-buffer
    (unless (zerop (process-file coffee-command nil t nil "--version"))
      (error "Failed: 'coffee --version'"))
    (goto-char (point-min))
    (let ((line (buffer-substring-no-properties (point) (line-end-position))))
      (when (string-match "[0-9.]+\\'" line)
        (string-to-number (match-string-no-properties 0 line))))))

well i'm not very familiar with elisp development, so i proposed this issue.

and the below function using coffee--coffeescript-version got a wrong result as well, which results in failure to open map file.

(defun coffee--map-file-name (coffee-file)
  (let* ((version (coffee--coffeescript-version))
         (extension (if (>= version 1.8) ".js.map" ".map")))
    ;; foo.js: foo.js.map(>= 1.8), foo.map(< 1.8)
    (concat (file-name-sans-extension coffee-file) extension)))

hopes this would be fixed, thx.

syohex commented 9 years ago

Thanks for reporting issue. I suppose we should use version<= function.

syohex commented 9 years ago

I have merged #321. Please check latest version.

Thanks for reporting.

crackhopper commented 9 years ago

Thanks for fixing!