Git Product home page Git Product logo

coffee-mode's People

Contributors

akheron avatar defunkt avatar disnet avatar dotemacs avatar geremih avatar ibrahima avatar jart avatar jvshahid avatar knu avatar kuanyui avatar lcoq avatar lorensr avatar marsam avatar mkhl avatar my8bird avatar no0 avatar purcell avatar rrthomas avatar rvernica avatar semperos avatar siruguri avatar sstephenson avatar superbobry avatar syohex avatar tav avatar telaviv avatar thomasf avatar tmcgilchrist avatar waymondo avatar wilfred avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coffee-mode's Issues

Please update version number

I'm using coffee-mode full-time! I just checked whether I should update my copy and noticed that while the version number is unchanged, the diff between what I have from a few months back and where you are now is significant. In terms of lines of diff, anyway. Updating the version number when merging pulls would be helpful. Thanks for a great tool.

Error in coffee-mode-hook in README

The example coffee-mode-hook has the argument --no-wrap, but that argument is no longer valid in the latest version of coffeescript. Including it as an argument for compilation will throw an error, so the example should be changed.

spaces at end of line are removed automatically

have a coffee file like

a = (t) -> (couple spaces AFTER the arrow)
......

Do some editing, and save the coffee file.

Result:

a = (t) -> (no more spaces after the arrow)

Similarly, a blank line with couple spaces becomes a blank line with not spaces.

They look the same, but it creates a lot of problems:

  1. Editor shouldn't modify the file content unless programmer ask it to do so explicitly.
  2. It creates a lot of false positive when this runs through diff

Missing argument

I get an error "invalid option: -s" while compiling coffee with coffee-compile-file. When i run coffee binary it lack -s :

-i, --interactive
-r, --run
-o, --output [DIR]
-w, --watch
-p, --print
-l, --lint
-e, --eval
-t, --tokens
-v, --verbose
-n, --no-wrap
-g, --globals
    --narwhal
    --install-bundle
    --version
-h, --help

nasty freeze in syntax highlighter

The code below causes Aquamacs to freeze for a few seconds in coffee-mode. Repeating the last line will lengthen the freeze. keyboard-quit doesn't stop the freeze, so I'm not entirely sure what's happening, but I suspect it is caused by the syntax highlighter misinterpreting the '/' character as a regexp delimiter (as in #23) and then choking on the brackets. It can be worked around by putting a closing '/' in a comment at the end of the line.

class Woot
  donk: ->
    1 / 1

[[-0]]
[[-0]]
[[-0]]
[[-0]]
[[-0]]
[[-0]]
[[-0]]
[[-0]]
[[-0]]

Freeze when '/' is followed by lots of brackets

The following bit will cause coffee-mode to freeze mid-display

hPI = Math.PI/2
for v in [ [   -1, 2], [    1, 2], [    1, 0], [   -1, 0],
           [ PI-1, 2], [ PI+1, 2], [ PI+1, 0], [ PI-1, 0],
           [   -1, 3], [    1, 3], [    1, 1], [   -1, 1],
           [hPI-1, 3], [hPI+1, 3], [hPI+1, 1], [hPI-1, 1],
           [ PI-1, 3], [ PI+1, 3], [ PI+1, 1], [ PI-1, 1] ]
  false

but neither

hPI = Math.PI/2 # /
for v in [ [   -1, 2], [    1, 2], [    1, 0], [   -1, 0],
           [ PI-1, 2], [ PI+1, 2], [ PI+1, 0], [ PI-1, 0],
           [   -1, 3], [    1, 3], [    1, 1], [   -1, 1],
           [hPI-1, 3], [hPI+1, 3], [hPI+1, 1], [hPI-1, 1],
           [ PI-1, 3], [ PI+1, 3], [ PI+1, 1], [ PI-1, 1] ]
  false

nor

hPI = Math.PI/2
for v in [ [   -1, 2], [    1, 2], [    1, 0], [   -1, 0],
           [ PI-1, 3], [ PI+1, 3], [ PI+1, 1], [ PI-1, 1] ]
  false

have trouble. Seems like a regexp parsing problem.

Single quotes

Single quoted strings do not show up as strings. Only double quoted strings do.

old-bolp not defined

The symbol old-bolp as seen here is void (undefined).

I imagine this was just a mishap during a refactor, but it stops the Backspace key from working in certain situations.

Indentation depth configurable using something else than tab-width

Hi,

it's quite unusual for an Emacs major mode to use tab-width for indentation depth. c-mode, c++-mode, javascript-mode etc use c-basic-offset; python-mode uses py-indent-offset; ruby-mode uses ruby-indent-level; sh-mode uses sh-basic-offset... you get the idea. See also http://www.emacswiki.org/emacs/IndentationBasics

It would be nice if coffee-mode would have a similar setting. I prefer to leave tab-width at 8 for best compatibility with other people's code, but that's far too wide for indentation of course.

Thanks!

PS: It looks like sometimes tab-width is used (implicitly by indent.el's insert-tab), sometimes coffee-tab-width. Is this by design?

coffee-previous-indent hangs emacs

Hello, cofee-previous-indent seems to be hanging emacs, if the previous line is not indented. Here's a quick fix, hope i didn't break anything ;)

  (save-excursion
    (forward-line -1)
    (if (bobp)
        0
      (progn 
        (while (coffee-line-empty-p) (forward-line -1))
        (current-indentation)))))

Syntax highlighting for function arguments

Patch adds some extra colors which I like. In this:

sum_the_nums = (num1, num2) => num1 + num2

Previously, everything on that line was black but with my patch "num1" and "num2" gets variable-font-locked and the "=>" operator keyword-font-locked. It makes it easier for me to see where the lambda functions start. YMMV :)

Add an after-save hook

Right now the examples include an automatic compile function which is called in "before-save-hook". This means that it compiles the old version of the file, before the latest changes have been saved. To get the latest changes compiled, you have to make a dummy edit, and save again.

It would be great to have an after-save-hook instead, to properly auto-compile the latest version of the file.

Support fill-paragraph on comments

Some modes support fill-paragraph (meta-q) on comments, with just the comment getting word wrapped (python-mode does this at least). Right now meta-q just reformats everything.

Cannot open load file: coffee-mode

Hi!

I was testing you mode.
I followed your instructions to install this mode.

Here is coffe-script chunk in my .emacs file:

; Coffee-Script mode
(add-to-list 'load-path "~/.emacs.d/coffee-mode")
(require 'coffee-mode)
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
(add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode))

And when I compile my emacs file (using M-x emacs-lisp-byte-compile, it throws this:

Compiling file /home/neoriddle/.emacs at Tue Sep 13 19:59:30 2011
.emacs:163:1:Error: Cannot open load file: coffee-mode

Is there something wrong?

Thank you very much.

Auto-indent doesn't work

I'm new to emacs so it is possible that it is my fault, but auto-indent doesnt work for me in coffee-mode.

I'm using emacs 23.2 in fedora 15, and installed coffee-mode as described in the README file. I also added the suggested lines to my .emacs file. I'm using the suggested 2-space indentation in the config.

I'm sure coffee-mode works, because the window does have the CoffeeScript menu, and the mode indicator is 'Coffee'.

Whenever i press RET, the cursor goes to the first character of the new line, except when there is an '->' sign, or something that indicates that the indentation level of the next line should be incremented by one. In this case, the indentation level is 1, so the cursor will be on the third character of the new line. Indentation behaves the same no matter what the current indentation level is.

Coffee Cleanup Whitespace: on is probably the wrong default

The CoffeeScript (compiler) sources are full of trailing whitespace, so trying to edit them with a non-customized coffee-mode results in a mess.

In general, this seems like a feature that can be useful, but has no place in a language mode.

Derive from prog-mode

Beginning with Emacs 24, modes for programming languages are supposed to derived from prog-mode.

Indentation doesn't work correctly on Emacs 24

Emacs 24 introduces a new way to handle auto-indentation with Return - namely electric-layout-mode. The custom indentation logic enabled by default in coffee-mode doesn't work particularly well with electric-layout-mode enabled - it seems to me that everything get indented twice. I guess it would be nice if you added some check whether electric-layout-mode is enabled or not which would alter the indentation behaviour of coffee-mode.

It's easy to get Emacs 24 if you're an OS X user - just to a

brew install emacs --cocoa --use-git-head --HEAD

coffee-line-wants-indent returns f on any bol indenter

Emacs 23.2.

I find that none of the coffee-indentors-bol actually match coffee-indenters-bol-regexp while editing except when the line containing the indenter was itself at an indentation level of 0.

For example, this is the unaltered coffee-mode indentation behavior that I observe:

if happy
  if know it
  claphands() # Shouldn't this have been indented?

I find that I can make it behave as I want it to if I remove the ^ from coffee-indenters-bol-regexp, as so

;; Works
(defun coffee-indenters-bol-regexp ()
  (regexp-opt coffee-indenters-bol 'words))

instead of

;; Broken
(defun coffee-indenters-bol-regexp ()
  (concat "^" (regexp-opt coffee-indenters-bol 'words)))

Based on the ELisp manual, I think that my replacement is correct when using the looking-at function.

Has anyone else actually observed this problem? It's just so fundamental that I reasoned it must be a problem with my particular setup...

Submit to ELPA

Pusing this to Marmalade would make it easier for users to install via package.el. Uploading is simple, but it has to follow the packaging guidelines, which includes having a ;;; coffee-mode.el ends here at the very end of the file.

Cygwin-style Absolute Paths on Windows for CoffeeScript on Node.js

First: thank you for all your hard work and contributions!

When compiling Node.js on Windows, the most common way is to use Cygwin. When using the coffee command via Cygwin-compiled Node.js on Windows, you have to use Cygwin-style absolute paths. So for example, instead of:

coffee --compile foo.coffee

You have to use:

coffee --compile /cygdrive/c/users/my_user/foo.coffee

That goes for any paths used in the command, including output dirs for compiled JS. My feature request is this:

Could you add support for system-type of windows-nt to your major/minor modes such that paths expand to the absolute Cygwin-path as shown above? I'll try to fork and make a pull request, but I'm putting this here in case someone who is smarter or has more free time can tackle it first.

Thanks again for all your hard work!

Setting tabs to two spaces breaks auto-indentation

If I add the following code to my .emacs file:

(defun coffee-custom ()
  "coffee-mode-hook"
  (set (make-local-variable 'tab-width) 2))
(add-hook 'coffee-mode-hook
          '(lambda() (coffee-custom)))

... then I get tabs inserted as two spaces, which is correct. However, this breaks auto-indentation.

I then create a new .coffee file and type in a class without using the TAB key (i.e. just relying on auto-indentation). Note how, with tabs set to two spaces, auto-indentation doesn't indent the body of the bar function:

class Foo
  bar: (baz) ->
  qux()

If I remove the above snippet from my .emacs file and try again, the body of the bar function is indented automatically:

class Foo
        bar: (baz) ->
                qux()

Auto-indentation on indented `for`

Hitting RET with point here:

task 'test', 'Run the test suite.', ->
  for file in fs.readdirSync('test/*')
                                      ^  

Needs to move point here:

task 'test', 'Run the test suite.', ->
  for file in fs.readdirSync('test/*')

    ^

Same with if and else.

typo in readme

In
(add-hook coffee-mode-hook
'(lambda() (coffee-custom)))

coffee-mode-hook should be quoted

Etags integration

Is there a way to make the imenu from multiple files be found on a Tags file?

Highlight block comments

Right now, only the first and last lines of the following are font-locked as comments, but everything should be:

###!
Something
Copyright (c) Foo and Bar
###

(Great work on coffee-mode! :)

Configurable Compilation Options

Feature Request

It'd be nice to be able to configure at least some of the compilation options used by commands like coffee-compile-region. I understand why -s and -p need to be there for that particular function, but --bare seems a little more arbitrary, and in general it would make sense to be able to pass arbitrary numbers of compilation options.

Again, I'm happy to make a pull request to get this done, but I'm putting it here where smarter/more available people can contribute as well. Thanks for a great Emacs mode for CoffeeScript!

fail to get error message when compile large coffee file

On Windows , Node v0.8.2 ,CoffeeScript version 1.3.3

I found a problem on compiling large coffee file (above150 lines) in coffee-mode: if there is some syntax error in the file. the shell-command-to-string function fail to fetch any error message from the shell command "coffee -b --bare largefile.coffee" process.

any one help?

Always indents to first level

Hi, using latest coffee mode from the git repo, and it will never auto indent beyond the first level for me.

pressing ret on second line

if foo:
  if bar:

  ^ cursor

pressing RET on fourth line

class Foo
  constructor: ->
    if 1:
      if foo:

  ^ cursor...

Anyone know what could be causing this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.