[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: %, comments, EOS, and parenthesis

From: Colin Ingram
Subject: Re: %, comments, EOS, and parenthesis
Date: Wed, 03 Aug 2005 16:26:07 -0500
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Ben Barrowes wrote:

I use the matlab.el with octave programs. Pretty much the only stylistic annoyance is that matlab.el doesn't recognize # as a comment character.

Interesting I will check out the Lisp code for mathlab.el maybe this feature can be added to octave mode.

Anyway, % inside strings (single quote) are not interpreted as comments and are properly recognized as strings instead of a comment char.

This is what I want.

% inside a double quoted string (octave only, no such support in ml) is interpreted as a comment char in matlab mode.

I have a similar but different problem with double quotes. With double quotes Emacs recognizes the code as a string (colored green) but if you have long line, when Emacs will insert continuation marks and indent the next line as it should but it then will insert `%' at the beginning of each line as if it were an inline comment.
fprintf (parafid, "tauD = %-.3f\nK = %-.3f\nF(inf) = %-#.4g\nF(-) = %-.4g\nError Code = %d\nIterations used: %d\nR2: %f\nGuess Used: %.3f\n%12s%-.3f\nFraction Recovered: %-.3f\nImmobile Fraction: %-.3f\n",param(1), K, Finf ,pref, error, iter, r2, pin(1),"", pin(2), f, param(2));

would get formated as:
fprintf (parafid, "tauD = %-.3f\nK = %-.3f\nF(inf) = %-#.4g\nF(-) ...
               %= %-.4g\nError Code = %d\nIterations
 used: %d\nR2: %f\nGuess Used: %.3f\n%12s%-.3f\nFraction Recovered:
               %-.3f\nImmobile Fraction:
               %-.3f\n",param(1), K, Finf ,pref,
               %error, iter, r2, pin(1),"", pin(2),
%f, param(2)); Only the last two lines which are outside the double quotes are colored red for comment though.

This is really annoying

Is this double quoted case your concern?

If so, this is another difference in the string handling between octave and ml that is potentially confusing.

No, The case I was talking about in my email was a single quote case. I just noticed remembered the double quote situation when you spoke of it, I went back a dragged out that code example. Interested I just noticed, that at least on my system octave mode doesn't recognize single quotes as strings at all. Is this supposed to be the case.

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]