Bugfixes In The TextMate MATLAB Bundle

Written by thomas on June 15th, 2007

As a result of feedback, I have commited a few bug fixes for the MATLAB bundle.

Changelog:

* Added handling of curly brackets.
* Added trigging on Enter in curly brackets.
* Removed automatic conversion of != to ~=. Highlighting as error instead.
* Minor changes

I should also mention that hitting the Return key, or is it the Enter key? Eh, anyway, the enterish key on the numpad should automatically indent and insert a new % if hit within a comment! This can be very useful if you have to write multi-line comments.

10 Responses to “Bugfixes In The TextMate MATLAB Bundle”

  1. Mike Dewar

    Says:

    Hello! Thanks for the update. A couple of things, um:

    How do I tell your bundle that I’m happy with i=3; and j=3;? I never use complex numbers but I do count with and i and j a lot and now I have these bright purple bits in my code..

    ‘classes’ (as in ‘clear classes’), ‘varargin’ and ‘varargout’ don’t seem to be highlighted as keywords.

    The other thing which might be a bit tricky is about using … to break a statement up over lines. Would it be possible to make the bundle check to see if there’s already a … at the end of the line to see if it needs to include one?

    Cheers, and thanks again for this bundle!

    Mike

  2. thomas

    Says:

    Regarding the marking of i/j assignment as illegal, I wasn’t a 100% sure I should do this. The problem is that you’re overriding MATLAB constants, and as such, I have now included ‘eps’, ‘inf’, and ‘nan’ in that list. If you want to manually remove the marking (and in the process further your unfortunate coding practices ;-), remove the variablecomplexoverride (or constants_override in the latest bundle) clause in the MATLAB file in the Bundle Editor. I’m not entirely convinced that we should remove this behavior, since it will alleviate potential problems, particularly for novice programmers. Thoughts?

    Regarding the ‘classes’, this isn’t, according to the Mathworks function list, a valid keyword. Could you specify where it’s from? The ‘varargin’ and ‘varargout’ are highlighted just fine here (as variable.other.function.matlab), but it may be that your theme doesn’t provide highlighting for this scope. I’ve considered, when I get the time, to create a new theme that incorporates all the MATLAB keywords properly. BTW, to see the scope of a keyword, hit ctrl+shift+p.

    About the addition of ‘…’, I’ll have to look into it. Could you send me an example of where this behavior is broken/weird?

  3. thomas

    Says:

    I have now changed the marking as invalid into the optional scope meta.inappropriate.matlab, which can be used in themes for marking the overriding of the aforementioned MATLAB constants.

  4. Weichang Li

    Says:

    hi, Thomas,

    Thanks for your updated matlab bundle! I have a problem with activating the matlab bundle in textmate. The installation went OK and I could see the matlab bundle appearing in the bundle edtor. However, no syntax highlighting for all .m files. My suspect is that .m files are being treated as Objective-C source files, as they are in Xcode, but not entirely sure if that is indeed the case. I would appreciate if you could drop me an email in case I am missing anything here.

    Thanks,

    Weichang

  5. anon

    Says:

    Hi, I grabbed a version from svn linked on another post - is that the most current one?

    Thanks for your work on updating this.

  6. thomas

    Says:

    Hi guys,

    I’m working on a few minor improvements to the bundle. Hopefully, I’ll have it completed tonight. I’ll post a new article when it’s ready.

    The version linked earlier is indeed the very last version.

  7. JMG

    Says:

    Hi,

    I was not very happy with the Matlab bundle on the Textmate site, and found yours via Google. You should definitely submit this to the official repository, ASAP.

    Thanks for your efforts!

  8. Frank

    Says:

    Is it possible to actually run m-files inside Matlab from Textmate?

  9. thomas

    Says:

    Frank: It’s not currently possible. I could make such a command, but unfortunately it would mean that you’d have to fully launch Matlab each time you’d want to run the file. As of yet, as far as I know, Matlab does not allow a server/client mode of operation, which would make this a breeze. They don’t have any proper API for communicating with Matlab either. If anybody have a good solution to this problem, I’d love to hear it.

  10. Wei

    Says:

    Hi Thomas,

    Could you fix the link for downloading the matlab bundles? It does not seem to work now. Thanks.

Leave a Reply