[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ignoring line prefix
From: |
Przemek Klosowski |
Subject: |
ignoring line prefix |
Date: |
Wed, 24 Jun 2009 14:24:54 -0400 (EDT) |
I am writing about a low-priority usability issue with the
interpreter, resulting from 'junk' prefixes on multiline input that
one is trying to cut-and-paste. It may result from quoting characters
in email:
> a=[
> 3,560 5,421 1.234
> 3,560 5,421 1.234 ]
or from Octave's own prompts, that are added when it processes
straight, non-prefixed code, either cut-and-pasted from another window
or typed on a command line. I am talking about cases like these, when
one inputs
for i=1:10 function y=f(x) y=sin(i);
y=sin(i) y=2*x z=sin(y);
end end
and Octave prints them back with prepended prompts as shown below, so
they cannot be simply reexecuted by cutting and pasting within the
window Octave is running in:
for i=1:10 function y=f(x) octave:5> y=sin(i);
> y=sin(i) > y=2*x octave:6> z=sin(y);
> end > end
It is a minor but recurring annoyance. Of course there are several
relatively straightforward ways of dealing with it: having an Emacs
window open and using Emacs's rectangle cut-and-paste commands is
simple enough, although I end up favoring packing code like simple
helper function definitions into very long lines so that I can call
them back using readline, edit and resubmit.
I was wondering how other people deal with it, and whether it you
think it is worth it to get Octave's parser to help, by for instance
having an Octave command that makes the scanner temporarily ignore a
prefix pattern, or even a fixed number of leading characters, from each
line. Maybe other people have better ideas.
- ignoring line prefix,
Przemek Klosowski <=