After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 136812 - Add a Matlab syntax highlightning to the GtkSourceView
Add a Matlab syntax highlightning to the GtkSourceView
Status: RESOLVED DUPLICATE of bug 170604
Product: gtksourceview
Classification: Platform
Component: Syntax files
git master
Other Linux
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
: 305925 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-03-10 21:24 UTC by Bednar
Modified: 2005-12-31 15:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Beginnings of MATLAB M-file language spec. Comments? (10.50 KB, patch)
2004-04-18 23:33 UTC, Kevin Duffus
none Details | Review
M-file language spec with all functions (28.84 KB, patch)
2004-05-13 07:20 UTC, Kevin Duffus
needs-work Details | Review

Description Bednar 2004-03-10 21:24:26 UTC
The GEdit doesn't colour Matlab files.
Comment 1 Paolo Borelli 2004-03-10 21:47:10 UTC
Moving the product to gtksourceview.

(To get the syntax highlighting you would have to create a matlab.lang
file)
Comment 2 Kevin Duffus 2004-04-11 10:11:58 UTC
I'm currently working on a lang file for MatLab M-files. I've just began so
expect a some time before a full (i'll try my best) inclusion of all matlab syntax.
Comment 3 Kevin Duffus 2004-04-18 23:33:01 UTC
Created attachment 26796 [details] [review]
Beginnings of MATLAB M-file language spec. Comments?
Comment 4 Kevin Duffus 2004-04-18 23:36:22 UTC
The comment "for now" is there only so that highlighting works on the m-file i'm
using as a test base. I'll move those functions to their own categories, like
the others, in the future.
Comment 5 Bednar 2004-04-19 21:26:01 UTC
That is just great. I have some ideas about, but I'm happy that matlab syntax is
reality :) I couldn't do that from scratch, because I didn't know how. Now I can
modify the specs myself. I think that copying color scheme from original
matlab's editor would be helpfull. Comments should be default green (dark) or
maybe ligth gray (like coments). Keywords like for, if, end should be blue
(0000FF) and so on.
I'm very thankfull for this work. By the way, I have one question? Is that
posibility to use gedit or another editor using gtksourceview as matlab IDE? It
is to add scripts or somethink else for matlab programs debugging. Matlab's
command window itself has that possibility:
 Debugging commands.
 
    dbstop     - Set breakpoint.
    dbclear    - Remove breakpoint.
    dbcont     - Resume execution.
    dbdown     - Change local workspace context.
    dbmex      - Enable MEX-file debugging.
    dbstack    - List who called whom.
    dbstatus   - List all breakpoints.
    dbstep     - Execute one or more lines.
    dbtype     - List M-file with line numbers.
    dbup       - Change local workspace context.
    dbquit     - Quit debug mode.
but Matlab's GUI (using Java VM) is horrible. The mouse scroll doesn't work, GUI
crasher quite often, etc. I think of using external editor (Anjuta ???) as
matlab's gui, but don't know how to debug programs.
Comment 6 Kevin Duffus 2004-04-26 05:42:45 UTC
>I'm happy that matlab syntax is reality :)
Glad you like it :)
>I think that copying color scheme from original
matlab's editor would be helpfull.
I'd love to do this as default but I'm unsure how to accomplish this from the
spec file. I started by using another spec file as a template so I'll have to
look into it.
>Is that posibility to use gedit or another editor using gtksourceview as matlab
IDE?
I'm not sure about all programs that use gtksourceview but gedit has a plugin
system which could allow you to make calls to the matlab binary and use gedit's
shell output plugin (not sure if plugin interoperability is possible) to display
what matlab has returned. MonoDevelop, a C# IDE, uses gtksourceview and has a
plugin system, as well. I'm not familiar with either source-wise nor am I a well
enough rounded programmer to tackle modifying the sources to do what your
looking for.
Comment 7 Bednar 2004-04-26 21:17:04 UTC
I'll try it (Mono Develop or gedit plugins) in spare time (what is spare time?
:). Thanks for all, tell me if I could help in somethink. I'm not a programmer,
but I know C and Matlab and use them to do some numerical research and algorithm
developing.
Comment 8 Kevin Duffus 2004-05-13 07:20:12 UTC
Created attachment 27661 [details] [review]
M-file language spec with all functions
Comment 9 Kevin Duffus 2004-05-13 07:21:26 UTC
I realized that categorizing the functions is quite cumbersome so I just created
a flat list of all functions and made them the "Keyword" style. Later i'll
filter out the constants (e.g., i, j, and pi) and add the following elements:
       Arithmetic Operators + - * / \ ^ '
       Relational Operators < > <= >= == ~=
       Logical Operators, Element-wise & | ~
       Logical Operators, Short-circuit && ||
       Special Characters [ ] ( ) {} = ' . ... , ; % !

btw, spare time == leisure
Comment 10 Paolo Maggi 2004-05-13 08:30:31 UTC
I have a questions about your m.lang file:

- Why do you want to highlight all the Matlab functions? I think it is enough to
highlight the keywords of the language (like if, else, etc) and eventually
operators and numbers.
- Why have you split the list of functions in several keyword lists? IIRC,
gtksourceview automatically makes this operation for you (to avoid a regex bug).
Comment 11 Kevin Duffus 2004-05-13 09:07:00 UTC
-  Hmm. I never thought of just highlighting keywords. To be honest, I really
like the colors ;-)
- GtkSourceView-WARNING **: Only the first 250 elements will be highlighted. See
bug #110991 for further details.
Comment 12 Paolo Borelli 2005-06-06 07:32:44 UTC
*** Bug 305925 has been marked as a duplicate of this bug. ***
Comment 13 Muthiah Annamalai 2005-06-13 03:13:55 UTC
A related GNU Octave lang file [http://bugzilla.gnome.org/show_bug.cgi?id=307452].
GNU Octave is a matlab clone, and implements MATLAB language.
I think they might share a MIME type if we ask gnome-vfs folks to add it
to their default gnome.mime. octave.lang implements basics.

I think my octave.lang is more complete, [derived from other .lang files ofcourse,
not my own work all of it], and works well.

I hope we add octave.lang over m.lang as octave.lang has:
   %, # as comment lines [default in Octave]
   'string' & "string" delimiters for STrings.
    A lesser and 'builtin' function + keyword lists.
    Not the whole thing, as I mean.

Thanks
Muthu
Comment 14 Paolo Maggi 2005-12-31 15:26:45 UTC
It seems the best .lang file we have is the søren's one attached to bug #307452 (that is a duplicate of bug #170604).

Marking this one as a duplicate of bug #170604.

*** This bug has been marked as a duplicate of 170604 ***