-
Notifications
You must be signed in to change notification settings - Fork 35
sometimes eats trailing parens when used with js3mode #40
Comments
I can't reproduce this. I installed |
Fair enough. I'll keep trying. Sorry for the noise. James This message has been scanned for viruses and |
No need to apologize, just put your
Then try your original example, which was clear enough. If you still get breakage tell me, otherwise the problem lies elsewhere in your .emacs. I can help you track it down. BTW in emacs-24.4 there is |
Yep, you are absolutely correct. Moving my .emacs.d aside and doing the simplest possible as you described shows that there is no conflict, but rather something else in my horribly crufty .emacs.d/ is broken. (That's the problem with gradually adding new features over the years and then discovering packages and melpa and all that good stuff about a year ago and just grafting the whole thing together.) So autopair is working fine with js3-mode on: "GNU Emacs 24.3.1 (x86_64-slackware-linux-gnu, GTK+ Version 2.24.17) of 2013-04-23 on hive64" I will clean up my init mess and try to figure out where the problem is. Thanks |
Okay, I take that back. I just realized I wasn't testing with js3 mode, but rather with javascript mode When started
and then edit some file, when I type the following, it is fine:
but then when I open the parenthesis after the
But then, strangely, if I keep typing, nested stuff works okay:
More strangeness, if I first fix the missing close parens, so I have:
and then I type inside the syntactically correct call, then autopair seems to shut down:
In that snippet, the first open parenthesis after As you suggested, I will try to use electric-pair-mode, but I wanted to feed more bug reports if this is useful to you. Thanks, |
It is useful, let me reopen it and I'll have a look soon. |
Just noticed something. I think it is related to the syntax highlighting of js3-mode, perhaps some sort of fight with which process gets to parse the text first? I was just writing some tests and had a typo: describe('fix component names',function(){
it('should fix wim names with a direction',function(done){
var fixed = fix_component_names('south',['wimid_27'])
fixed[0].should.eql('wim.27.S')
return done()
})
if('should fix')
}) The open parenthesis after "if" auto-generated the close parenthesis. describe('fix component names',function(){
it('should fix wim names with a direction',function(done){
var fixed = fix_component_names('south',['wimid_27'])
fixed[0].should.eql('wim.27.S')
return done()
})
it('should '
}) After typing the "if" it is highlighted red, as a syntax error (if without the condition). Type the open parens, and the close shows up. After typing the "it", it is plain white (no syntax highlighting). Type the open parens, and it doesn't close. So maybe after the syntax error, the JS3-mode parser switches off, allowing the autopair parser to get in there first? Whereas when the "it" is written, the JS3 parser is still watching the text to decide how to color it, thus conflicting with the autopair parser?? Note this is in my regular working emacs setup, not in the "cleanroom" version. |
I am using autopair with js3mode
When I type the following, I don't get what I expect:
What I type:
that is fine. but then when I add the callback function argument:
notice, I've only typed the opening parenthesis after function, and it did not echo the closing parenthesis. Then, when I finish defining the function like so, and type the closing parenthesis, I get:
The second parenthesis is gone, and should be outside of the closing brace.
This is just a conflict of some sort with js3 mode, as far as I can tell. When I type the same stuff in, say, a markdown file, I get:
Again, notice the second parenthesis isn't gone, but is outside of the brace.
Thanks
The text was updated successfully, but these errors were encountered: