Problem with js2 mode in emacs-starter-kit

64 views
Skip to first unread message

szimek

unread,
Jan 7, 2009, 6:03:47 AM1/7/09
to Rails On Emacs
Hi,

The code in starter-kit-js.el file causes some strange behavior in js
files. Whenever I change anything in the file (insert new character,
undo changes), the cursor is automatically moved right after the last
occurence of "f(" string - where "f" is this strange character that is
introduced instead of "function" string.

Commenting out the code inside starter-kit-js.el file fixes this
issue.

BTW. It may be good idea to provide instructions in the wiki/readme
file how to compile js2-new.el file before js-mode can be used.

mixandgo

unread,
Jan 7, 2009, 10:34:54 AM1/7/09
to Rails On Emacs
thanks for that, I was wondering what's with the weird behavior too.
any idea why that happens ?

Mat

unread,
Feb 7, 2009, 11:45:51 PM2/7/09
to Rails On Emacs
And how do you compile js2-new? I've been trying a bunch of things and
still just get "You must byte-compile js2-mode before using it.". And
I don't get any javascript syntax highlighting without calling M-x
javascript-mode manually.

Thanks,
Mat

senny

unread,
Feb 8, 2009, 3:51:33 AM2/8/09
to Rails On Emacs
Hey Mat

You can byte-compile js2 mode with M-x byte-compile-file ENTER <path-
to-js2.el>. Then you can use js2-mode for your javascript files
instead of javascript-mode.

Diego Fernandez

unread,
Feb 8, 2009, 6:24:51 AM2/8/09
to emacs-o...@googlegroups.com


On Sun, Feb 8, 2009 at 9:51 AM, senny <yves...@gmail.com> wrote:

Hey Mat

You can byte-compile js2 mode with M-x byte-compile-file ENTER <path-
to-js2.el>. Then you can use js2-mode for your javascript files
instead of javascript-mode.

Or you can just install it from ELPA. There's even a built-in function in the starter-kit to dealt with this and other not installed packages [1]

[1] http://github.com/technomancy/emacs-starter-kit/blob/fe721654bd21825d36bace0f46a79271c5769cc1/starter-kit-elpa.el
--
Diego Fernández Fernández

http://simplelogica.net

Steve Purcell

unread,
Feb 8, 2009, 8:16:15 AM2/8/09
to emacs-o...@googlegroups.com
The Elpa version of js2-mode is 20080419, whereas the latest is 20080616a.  I'd love to see elpa gain traction, but I get the impression that maintainers don't diligently update their packages.

-Steve

Mat Schaffer

unread,
Feb 8, 2009, 1:14:55 PM2/8/09
to emacs-o...@googlegroups.com
On Feb 8, 2009, at 3:51 AM, senny wrote:
> You can byte-compile js2 mode with M-x byte-compile-file ENTER <path-
> to-js2.el>. Then you can use js2-mode for your javascript files
> instead of javascript-mode.

Thanks, that seemed to work. I kept trying to byte-compile js2-new.el
per comments here: http://code.google.com/p/js2-mode/wiki/InstallationInstructions

Only now there seems to be a bug in this version where every time I
type something in, it jumps me to the first function() in my file.
Anyone else seeing this problem? I'm running a fork of master fe721654.

Thanks,
Mat

senny

unread,
Feb 9, 2009, 2:53:21 AM2/9/09
to Rails On Emacs
Hey Mat,

I've encountered the same problem with *.js files. I think it is a bug
in the starterkit. As far as I van rememember i fixed it in my
configurations. You can get a look at them here:
http://github.com/senny/emacs-configs/tree/master.

regards,
senny

Mat Schaffer

unread,
Feb 9, 2009, 9:06:38 AM2/9/09
to emacs-o...@googlegroups.com
Thanks, Senny. I didn't get javascript highlighting out of the box
with this one and you also rebound M-x. How can I compile the js2-mode
stuff now?
-Mat

Mat Schaffer

unread,
Feb 9, 2009, 9:16:01 AM2/9/09
to Mat Schaffer, emacs-o...@googlegroups.com
I found your bindings.el. And tried M-a to byte-compile-file elpa-to-
submit/nxhtml/related/js2.el but now I don't seem to have a js2-mode
command.
-Mat

senny

unread,
Feb 9, 2009, 12:50:20 PM2/9/09
to Rails On Emacs
Hey Mat,

At the moment i dont have nxhtml mode autoloaded because I dont have
the time to configure it the way i want. You can install js2-mode with
the command: M-a starter-kit-elpa-install ENTER
This should then install all the dependencies from elpa. If you only
want to fix the curser-jump-error for js2-mode in the normal starter-
kit, you cold diff my configurations against the ones from the starter-
kit. I think i've made these changes in a file that already existed.

Mat Schaffer

unread,
Feb 9, 2009, 2:23:04 PM2/9/09
to emacs-o...@googlegroups.com
Fair enough. Guess I'll start working on my own fork of starter kit.
Thanks,
Mat

szimek

unread,
Feb 20, 2009, 3:10:18 AM2/20/09
to Rails On Emacs
Has anyone managed to fix js mode problem with cursor jumping to the
"function()"?
I checked senny's fork and applied his change to starter-kit-js.el
file (http://github.com/senny/emacs-configs/commit/
51cf3cdce1838cc6e91d73c647cd25a6444d6d59#diff-7), but it still doesn't
work for me.

I've tried it with emacs 22 and emacs 23 on Ubuntu.

senny

unread,
Feb 20, 2009, 10:18:33 AM2/20/09
to Rails On Emacs
Hey szimek

Ive gone trough my changes to the starter-kit and I think the fix was
to comment out the (pretty-lambda) call in the coding-hook function
(starter-kit-defuns.el)

You probably applied the wrong patch from my frok. I think this one
should do the trick (http://github.com/senny/emacs-configs/commit/
421710000c10b1a6eb513835fcdacb15a5f91016)

regards,
senny
Reply all
Reply to author
Forward
0 new messages