electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Updated chuck-mode for Emacs
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [10 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
kcfelix



Joined: Jul 02, 2009
Posts: 4
Location: Porto Alegre, Brasil

PostPosted: Thu Jul 02, 2009 11:27 am    Post subject: Updated chuck-mode for Emacs Reply with quote  Mark this post and the followings unread

Hello folks,

I've announced this on the chuck-users list and they told me it would be nice to announce it here too.

I've just discovered and started learning ChucK and It's very neat. As I'm an Emacs user I downloaded the emacs mode for editing ChucK files. It was rather old and was missing some functionality so I've made an update.

http://bitbucket.org/kcfelix/emacsd/src/tip/my-lisp/chuck-mode.el

Features of this update:

  • Syntax highlight more consistent with other languages supported by Emacs
  • Added all keywords, types and library functions listed on the documentation.
  • C-c C-c inside a ChucK buffer will send the buffer code to the VM. If there's no VM process one will be created
  • C-c C-d remove a shred from the VM by a numeric id
  • C-c C-r replace a shred with the code on the current buffer
  • Easy customization for the path of the chuck executable, so you don't have to edit lisp code to change it.


Class and method name highlighting is not working yet, but I plan on adding it soon.

Well, I'm planning to update it frequently to make it better according to my use of it, but if there's anyone using Emacs for ChucK and want to give some advice it would be very nice Smile

If you use it and test it send feedback to the issue tracker: http://bitbucket.org/kcfelix/emacsd/issues/new/
Sugestions for enhancements are welcome as well as bug reports.

Right now it has been tested under Windows Vista and GNU Emacs 23. Future testing under Ubuntu Jaunty will be done soon too.
Back to top
View user's profile Send private message
mrcold



Joined: Jun 18, 2009
Posts: 187
Location: USA
Audio files: 31

PostPosted: Thu Jul 02, 2009 8:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

this is really cool.. too bad i don't like emacs Smile

but really.. nice work.
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Thu Jul 02, 2009 10:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

welcome kcfelix.

Thanks for this update. thumleft I think I'm going to try it out in Aquaemacs on OSX, see how it works (been meaning to try out another text editor on the Mac for a while).

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Sat Jul 04, 2009 3:50 am    Post subject: Reply with quote  Mark this post and the followings unread

The syntax coloring works nicely in Aquamacs, though something went wrong when I tried to add a shred. I've added an issue report at BitBucket! Smile

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
kcfelix



Joined: Jul 02, 2009
Posts: 4
Location: Porto Alegre, Brasil

PostPosted: Sun Jul 05, 2009 12:13 am    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:
The syntax coloring works nicely in Aquamacs, though something went wrong when I tried to add a shred. I've added an issue report at BitBucket! Smile


Stefan, thank you for reporting Smile

I'll do my best to get around the issue. I have some theories about this, but it's a little difficult because I don't have access to a Mac to test it right now. I'll try under linux to see if it behaves similar to that. As soon as I have some answers I'll report back to you.

_________________
--
Kao
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Sun Jul 05, 2009 2:13 am    Post subject: Reply with quote  Mark this post and the followings unread

Yeah it's not the most ciritical of bugs for me - I'm used to keeping an open terminal where I run the chuck application anyway. Besides, I often need to run with arguments (to get multiple in/out working) - but not always, and to have that work I'd need to edit the chuck-mode.el file. Could there be a simple way to load arguments - maybe by an environment variable or something?

Found an indentation thingie, adding that too to bitbucket.

Anyway, I think this syntax coloring makes things easier, and it's fun to try out emacs again (been 10 years or so). Smile

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Sun Jul 05, 2009 2:21 am    Post subject: Reply with quote  Mark this post and the followings unread

Blast! The colouring just stopped working! It no longer colours .ck files I open. The only thing I did was edit the "(defcustom chuck-exec "chuck"" line... Could you help a rusty emacser with a command that shows modes I have installed and/or what's wrong with them?

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
kcfelix



Joined: Jul 02, 2009
Posts: 4
Location: Porto Alegre, Brasil

PostPosted: Sun Jul 05, 2009 3:38 am    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:
Blast! The colouring just stopped working! It no longer colours .ck files I open. The only thing I did was edit the "(defcustom chuck-exec "chuck"" line... Could you help a rusty emacser with a command that shows modes I have installed and/or what's wrong with them?


That's really odd. Is it just with chuck files or is it happening with other type of files too? The modeline is indicating that ChucK mode is active? It could be that emacs is not more associating ck files with chuck-mode, but I have no idea why would that be the case.

Well, normally if something is wrong with anything loaded by your .emacs, the *Messages* buffer should contain something about it. Starting Emacs with the --debug-init option should also give you the complete stack trace of the error. You could also try to run the chuck-mode command to activate chuck-mode on your file and see what kind of message you get. If emacs says the command doesn't exist it's a signal that it didn't even could parse chuck-mode.el and you should check the file for errors.

If you edited the chuck-mode.el by hand, check if you didn't leave any open string quotation or parens around the lines you changed. The syntax highlight for elisp should made it obvious in the case of a string, so it's most unlinkely, but in the case of an unclosed paren you will have to check them manually. Emacs highlight matching pairs of pares when you put the cursor on an opening paren or right after a closing one, so it should be easy to check if there's any unbalance. You can always download a clean version of the file on the repository anyway Smile I've added some few new stuff in the last few days, but they aren't very dramatic changes. I should probably setup an wiki page somewhere to document the updated features of the mode.

Well, you should also know that you can change the value of the chuck-exec variable by means of an nice interface called "Easy customization". Just do M-x customize-variable <RET> chuck-exec and a buffer will open where you can change the variable value and then set it in many different ways (just for now, save it for future sessions, revert to the default, etc). If you choose to save it, it'll be written at the end of your .emacs with some special comment annotations so that the custom interface can find where to write all it's customizations. The nice thing about easy customization is that you can change a LOT of options without having to code any lisp by yourself. Type an M-x customize and you will be presented with a list of links of "customization groups" and each of those have many related options put together. It's a very nice feature IMHO, and it's also easy to make your package support it (the defcustom form is exactly for that).

Well, hope it helps!

_________________
--
Kao
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Sun Jul 05, 2009 4:00 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi!

I copied ~/.emacs.d/init.el to ~/.emacs.el and then it started working again. Could be something weird going on with Aquamacs maybe...

Anyway, I have a method for solving this problem that I can probably use to troubleshoot if it happens again. Thanks for your explanation of things Smile I'm starting to rediscover why I used to like emacs.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
kcfelix



Joined: Jul 02, 2009
Posts: 4
Location: Porto Alegre, Brasil

PostPosted: Sun Jul 05, 2009 3:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

Fixed the indentation bug Smile
Also, I've added a specific page on the wiki for using ChucK on Emacs:

http://wiki.cs.princeton.edu/forums.html/ChucKWithEmacs

I'll document the features of my mode there, updating when I add anything new, so keep an eye on it!

And glad you are liking Emacs again. I think it's a wonderful editor. Amazing how easy it is to add support for editing any language! Updating this mode is being a great experience for me. I was trying to put myself on learning elisp, but never found the proper motivation.

_________________
--
Kao
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [10 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use