I’ve been using matlab-mode in Emacs for my scientific programming in Matlab for years. It is really an awesome little package, that I couldn’t live without.
However, lately Emacs has been freezing up completely on my Ubuntu 9.10 installation (using 100% of the CPU) when editing comments (i.e. lines starting with a percent symbol) in matlab-mode.
I’m not sure about the exact circumstances when this happens—it doesn’t happen with all comments—but the same problem seems to occur in all versions of matlab.el from 2.2-3.3, so likely there is some inconsistency between matlab.el and new Emacs versions shipped with Ubuntu Linux. These problems started occurring sometime in 2009.
Freezes sometimes occur when:
- using Esc-Q to use matlab-fill-paragraph
- when manually inserting a ‘%’
- when using M-J to use matlab-comment-line-break-function
As those are really essential functionalities, I’ve found that matlab-mode now is almost unusable.
Without spending too much time debugging the problem, I have been able to find a simple workaround. Over time I’ve noticed that freezes occur only when editing header comments, i.e. comments at the top of a file (technically where no uncommitted code lines are present between the point of action and the beginning of the file). In fact, in cases when a freeze has occurred I can kill and restart Emacs, insert some random code above point of action and repeat the same action (that before triggered the freeze) without problems. For now I’m using this as a workaround for the problem, while waiting for a fixed matlab.el to appear.
