Code covered by the BSD License  

4.23684

4.2 | 39 ratings Rate this file 58 Downloads (last 30 days) File Size: 2.29 KB File ID: #104

Edit .m files in Emacs

by

 

21 May 1999 (Updated )

A major mode for editing .m files under GNU-emacs

| Watch this File

File Information
Description

Documentation on downloading a major mode for editing .m files under GNU-Emacs.

This project is managed on SourceForge.

http://matlab-emacs.sourceforge.net/

MATLAB release MATLAB 5.2 (R10)
Other requirements Emacs or XEmacs
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (44)
13 May 2013 Kevin

I like this a lot but here is a bug report:

Emacs locks up when trying to tab in a Matlab file which contains a content with the word 'for' in the comment. Ctrl-g breaks out of the loop.

31 Dec 2012 Jerry

Can I fold or imenu section(%%) in .m file by emacs?

15 May 2012 David  
09 Jun 2010 coyboy

Can anyone help me? Please send me a copy of file "matlab.el". There is some unknown problem for me to download from sourceforge net. I currently use old version. I want to try new.
coyboy911@sina.com
Thank you!

16 Apr 2010 Ernst Kloppenburg  
19 Jan 2010 Rob Campbell

Good stuff!! I couldn't manage without this because I'm so much faster in emacs. However, I must agree with those who say that this is currently lacking features compared to the Mathworks editor.

11 Nov 2008 mark p

I got the debugger working somewhat by loading the matlab-shell and calling "dbstop". Emacs shows an arrow at the line of code I'm currently stopped at. I was wondering:
1) Can emacs display where my breakpoints are?
2) Is it possible to set/remove breakpoints from emacs instead of having to type dbstop/dbclear?
3) Is there anyway to step code with a single key in emacs? (like f-10) rather than having to type 'dbstep' every time in the matlab portion of the window?

thanks
-mark

25 Jul 2008 Scott Otterson

This mode is very good, but I'm afraid it's falling behind the evolution of the Matlab language.

I'm a rabid emacs user so I still use matlab.el, but I'm also experimenting with the emacs keybindings in the Matlab desktop. On the desktop, code highlighting and indenting work correctly, and there's an up-to-date debugger interface. On the other hand, many emacs key combinations are missing -- for just cranking out code, emacs/matlab.el is faster, at least for me.

I haven't yet decided which environment is more productive overall.

15 May 2008 huy pham

I need help with this. When i try to launch matlab from emacs, it would not work. I think the load-path was not set up properly. Where can I go to edit it?

07 Apr 2008 x y  
26 Jun 2006 Chethan P

i do love this mode and use it every day. it would be wonderful to see support for object oriented programming in the indentation blocks (class, methods, properties, having functions indented inside a class definition, etc). right now as far as i can tell declaring a function resets the overall indentation, so a function inside a class kind of screws everything up.

thanks for this, it's great.

25 May 2006 Ike Stoddard

I love it, and am grateful. In the spirit of cooperative improvement, I submit:
Bug Report, v2.3.1 in Unix (OSF1 V5.1 2650 alpha; XEmacs 21.1; May 1999) or Linux(GNU Emacs 21.3.1 (i386-redhat-linux-gnu, X toolkit, Xaw3d scroll bars) of 2003-05-22 on porky.devel.redhat.com):
Strings of '%' (e.g., used as boxes or separators) cause CPU looping. ^G terminates. Need to avoid the looping in the first place.
Also: fails to indent properly after comment lines as previously reported.

08 Mar 2006 John Murphy

I have been using this for some time now and think that it is great. It is too bad that the native matlab editor cannot do a better job with its emacs emulation, as switching between the two for debug can be tiresome. Thank you for making this available.

16 Nov 2005 Bjørn-Helge Mevik

I have the same problem as reported by Alexey Koloydenko. The script that starts matlab (for me: /opt/matlab/bin/matlab), uses exec when starting the binary, and Emacs' start-process (which is used by comint, which is used by matlab-shell) doesn't seem to like that. Creating a script that runs
/opt/matlab/bin/matlab "$@"
works perfectly, while
exec /opt/matlab/bin/matlab "$@"
gives the "hangup"-message. (The "$@" is just so matlab-shell can pass arguments (e.g. -nodesktop) to the program.)

(I have no idea whether this is a problem with Emacs' start-process or the Matlab binary.)

01 Nov 2005 Alexey Koloydenko

Versions 2.3.1 and 3.0.1:
For some reason, I can only get the shell to work if I create an executable file containing the appropriate command (e.g. on my machine: /usr/local/bin/matlab -nodesktop -nojvm) and refer the matlab-shell-command variable to that file. Going directly fails with either '' M-Shell hangup'' (with the default matlab-shell-command variable provided by matlab.el) or with ''Can't exec program: /usr/local/bin/matlab -nodesktop -nojvm'' with '(matlab-shell-command "/usr/local/bin/matlab -nodesktop -nojvm"). Otherwise, I have been happily using this resource for several years.

28 Sep 2005 Dai Stevei

Maybe I have the problem
I went through the source code of matlab.el version 2.3.1 with 2.2.3, and found the difference between two:
>in matlab.el v2.2.3 line 3659, the code is : comint-prompt-regexp "^K?>> *"
>but in v2.3.1 or higher ,the code is :comint-prompt-regexp "^\\(K\\|EDU\\)?>> *"
>I guess it maybe the problem, so I revised the source code of the version 2.3.1,and it works! then I tried the version 2.3.2 and version 3.0.1, It works in v2.3.2,but failed in 3.0.1.

28 Sep 2005 Dai Stevei

There are bugs in matlab.el version higher than 2.3.1, because it can't not work correctly in windows xp, but works correctly in linux

the problem is:when lauch matlab-shell(the matlab-shell works correctly on cmd.ext),there are infinitly "<<",then the matlabshell cann't stop,always display "<<", so the whole screen is "<<<<<<<<<<<<<<<<<<<<<<<<<<...",and the buffer size is grow larger and larger, I don't kown why, but the matlab.el verson 2.2.3 works correctly

26 Aug 2005 Jani Lahtinen

The matlab-shell fails to work with 7.1.0.7 (R14) Service Pack 3 and GNU Emacs 21.3.1. When starting with M-x matlab-shell the result is "M-Shell hangup"! The variable in the line 82 from matlab-shell-command-swithes should be matlab-shell-command-switches -Add the notable 'c'!

23 Aug 2005 Tom Toth

Hangs after multiple comment lines if they're at the beginning of the .m file.
I like the many configuration options.

01 Aug 2005 Ted Catchpole  
06 May 2005 Yeah Right  
18 Mar 2005 Matthias Habl

When having two or more consecutive comment lines, pressing <enter> causes Emacs to hang. Fortunately C-g can break this infinite loop.

24 Feb 2005 Yossi Farjoun

Better than the Matlab editor IMHO.

One (tiny) bug I found: if you have a variable named 'end_something' and you have a block like so:

if a>b
end_something =0;
end

the indentation doesn't work properly.

Cheers.

21 Jan 2005 Matyas Sustik

Indentation does not work after a comment line.
The default indentation is 2 while in the GUI it is 4. Otherwise it is of great help! Thank you very much!

03 Jan 2005 Zhiheng Cao

Emacs gives me an error when I try byte-compile-file:

Compiling file /home/polaris/cao/matlab/matlab.el at Mon Jan 3 17:45:47 2005
** reference to free variable matlab-eei-process
While compiling matlab-mode:
** assignment to free variable add-log-current-defun-function
While compiling toplevel forms:
!! Invalid read syntax ((")"))

29 Nov 2004 Ben J

Very nice!

19 Nov 2004 Max Lin  
28 Oct 2004 Steve Badelt

For more "modern" implementations of matlab, with the Java interface, you may want to modify the following in the .el file:

(defcustom matlab-shell-command-switches ""

to

(defcustom matlab-shell-command-switches "-nodesktop"

the same can be directly edited in the .elc file if you have it.

03 Sep 2004 Stephen L.

First off, thanks for making this available. One fix that I think is needed: When you insert a function from the menu, the name of the function (in caps), should be right next to the percent sign. There should not be a space.

Other then that, thank you for making this available.

09 Aug 2004 Hirak Parikh

Make sure that you put the .el file in the
/lisp folder wherever EMACS is stored or atleast add the path in the .emacs file

04 Feb 2004 Dave Lin

Thanks so much for making this available. I've always found MATLAB's built-in editor somewhat annoying, and you've liberated us from that.

21 Dec 2003 Masahiko Mizuno

It is good for me to program on UNIX.

08 Dec 2003 Jerry Chen

good work....with a little typo in the comment:
it should be :
(setq matlab-shell-command-switches '("-nojvm"))
instead of
(setq matlab-shell-command-swithes '("-nojvm"))

06 Dec 2003 Josiah Yoder

Thanks... for those addicted to the many tools in emacs like me, this is great! It was easy to get working, too!

29 Nov 2003 Damiano Cozza

Only can say: "...thanks!"

31 Oct 2003 Stephan Weiss

Many thanks - this is really great help!

15 Oct 2003 Satya Mishra

Matlab-mode brings the power of emacs and the power of matlab-engine together to build a great software. Matlab's own GUI is a pale attempt at making something useful.

25 Sep 2003 Edward Grace

Far better than the Matlab editor!

17 Jul 2003 Wolfgang Brandhuber

Thanks for that emacs-mode.
It really helps a lot.

03 Jul 2003 Kaoru Amano  
28 Mar 2003 Pete Watkins

Awesome: The emacs mode is a very convenient way to use matlab

27 Jan 2002 Bjorn Gustavsson

.....but I still have to come up with the
algorithms....

06 Dec 2001 Shai Ayal  
06 Nov 2001 Jody Klymak

Excellent mode - works well in Gnu/X Emacs. Prompt support via mailing list.

Updates
08 Apr 2002

Need to have this link

27 Sep 2002

Version 2.3 of matlab.el

16 Jul 2003

Fix some bugs

17 Jul 2003

Fix some bugs

31 Jul 2009

Remove file under GPL, replace with documentation under BSD license.

Contact us