[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What editor to use in combination with octave?
Re: What editor to use in combination with octave?
Wed, 01 Sep 2010 23:06:44 +0200
Thunderbird 188.8.131.52 (X11/20100411)
> Please excuse a long post. I have experimented with a variety of editors and
> I find this question interesting.
> I also mainly use Gnome under Ubuntu (also OpenSuSE and other distros
> including the disappointingly named "Scientific Linux"). I have also used
> KDE but I have the prejudice that Gnome consumes fewer resources (and other
> desktops consume less but Gnome is a reasonable compromise).
> There is a certain tension in selecting a suitable editor. Some are
> extremely powerful but, unfortunately, we live in a world in which those who
> do *not* work primarily in software development have, in general, (I would
> say "for better or for worse" but I am convinced it is "for worse"!)
> absorbed certain conventions of the editors that went on to become class
> leading word processors. That leaves a burden of expectation of how an
> editor will work that conflicts with how the most powerful editors actually
> *do* work.
You got my attention with this paragraph. Emacs and vim really are good
for writing text, yet we have these word processors that are nothing
like them. Editing in word processors actually is a big hassle. This
also applies to text editors that mimic them. The big two (Emacs and
vim) has the basic editing, searching and navigation far superior to a
word processor. That's what makes them excel (ha!). Yet most
"programmers editors" don't even implement the basic editing power of a
word processor, they are just Notepad in these terms, with some added
bells and whistles.
For instance, I use shortcuts like M-d, M-f, M-b, M-m, C-s, M-%, C-x o,
C-x b, C-x r d, ALL the time. I don't feel like iterating what these
commands mean, but they all are the kind of functionality that typically
requires a mouse, multiple keystrokes or awkward keyboard chording in a
> So, the question arises whether to unlearn the expectations that represent
> the pollution of the common word processors and to relearn the conventions
> of one of the powerful editors, or whether to find an editor that
> accommodates those expectations. It is a difficult choice. I do not work in
> IT and, whilst I would like to become proficient in a "proper" editor, I
> cannot justify the time that it would take. My understanding of the powerful
> "proper" editors is therefore made from a position of dabbling rather than
> becoming proficient.
> It is worth noting that the Octave handbook (authors: JWE, DB, SH) includes
> an appendix that explains how to set up emacs to edit Octave. In a sense,
> that appears to make it the "official" choice of development environment (I
> would be interested in others comments on this). I understand that it was
> written largely by the great Richard Stallman as the first stage for writing
> GNU (so that he wrote most of the code underlying GNU using it). As noted by
> a previous poster, emacs may become a "way of life". It may be used for many
> things including, for example, a LaTeX editor. It is also possible to use it
> as a front end for R. I don't know enough about emacs to set up a single
> version that will do all of these things so that for example I have tried
> TeXmacs for LaTeX and a version modified by someone else for R called "ESS"
> ("emacs speaks statistics). With regard to Octave, it does allow the
> development of several scripts simultaneously (that will interact with each
Basically, if you are used to M-q, you want to be able to use it
everywhere. And Emacs provides. So, yes, it can become "a way of life".
> I have tried Emacs and I learned how to "pipe" code in development to a
> terminal. I am not sure whether that is a real terminal or a virtual one
> controlled (as a daughter process) by Emacs - I note that some other editors
> I have used are careful to make this distinction. I expect those proficient
> in Emacs will know merely because of their background. I experimented with
> Vim (and I downloaded "Imperator" for Firefox to practise its use) but I
> never learned how to have several windows open or how to "pipe" code to the
Well. On Windows, it's messy. But on unix-like systems, a process just
getting piped to another process won't accept it as a terminal (yes,
many programs do check if they are talking to a terminal or not). So
you'd have to make sure that the process really thinks it's in a
terminal. And when you have done that, you need to emulate an actual
terminal protocol. Actually this is what xterm, gnome-terminal and
konsole does. So it's complicated, as you suspected. I don't think
(dare I say this?) Emacs have a terminal emulator. Would be useful, though.
> On to the less "macho" options that behave as expected by non-experts!
> I have used QtOctave and I admire those trying to develop it but I
> encountered many bugs (I have posted here before to explore whether the bugs
> lay with QtOctave or Octave). Personally, I would not recommend it at its
> current stage of development.
I tried it three years ago and made the same conclusion then, I'm sorry
to say. The big problem I had with it was how it was just piping data
You should try octavede. It does have a full terminal emulator, so it
behaves exactly like octave/readline does in a... terminal emulator.
> As I used gnome, I have tried "Gedit" and "Geany". These have the more
> familiar conventions for editing (marking, cutting, copying etc) text which
> means that they are quicker to learn but I know that users of Emacs and Vim
> note that they are less flexible. I never worked out how to "pipe" scripts
> to the terminal from Gedit but I was able to do this from Geany. There was
> an annoying problem with the interpretation of the last line in the program
> - I required two returns (I expect that this was something to do with
> different conventions in Unix and the other thing which shall not be named,
> concerning the distinction between line feed and carriage return - I expect
> I would have sorted it out eventually if I had stuck with it).
That last line, let me guess, didn't contain a newline? Many programs
don't like that, they like the file to end with a newline. Maybe this
'Geany' program was like that. 'cat' is like that :)
I have never really gotten the whole cutting and pasting thing down, or
having a process that one force-feed through a pipe. I just write
scripts and execute them at the octave prompt.
> However, under the advice of a friend, I have installed "Kate" (available
> through Ubuntu repositories - it is necessary to install a couple of other
> things to make it work in Gnome rather than KDE but it was straightforward).
> Of the "conventional" editors I have tried, I found Kate the most useful. I
> can "pipe" the scripts easily to a virtual terminal (which is explicitly
> identified as a virtual under the default settings - I understand that I
> could pipe it to a separate terminal but then I would not be able to
> interrupt a script if it wandered off course). Kate does not appear to cause
> problems with the last line of the script (I presume because it has
> different default conventions for line ends).
> All of the "conventional" (non macho) editors appear to have an upper limit
> on the size of block of script that may be submitted in one go to the
> terminal (I had to split some scripts into two to make them work). This
> problem did not appear to exist in Emacs (and I expect this also applies to
> Vim). It is possible that I can resize some buffer somewhere but I can't
> find a way to do this using the manuals supplied with the various editors).
This is all becomes irrelevant if you
A) Make sure to write functions for calculations and plotting
B) Write script files where you have test input for the previously
The benefits are that you are separating application (test scripts) from
functionality (function files). This is an important concept. If
application and functionality are mixed up, I found that programs get
hard to work with.
This way you also get to work with files on disk. Don't get me started
on version control systems...
> I personally feel that Kate is the best one of this
> type and I can confirm that it runs under Gnome. I have encountered one
> minor problem - I installed a couple of octave add-on packages ("statistics"
> and "miscellaneous" - which is required by statistics) and this yielded
> error messages that suggest that the help file did not properly integrate (I
> presume that would be a KDE/Gnome thing rather than an Octave thing).
It's probably the packaging of octave that's bonked on your
distribution, but it's hard to speculate.
- Re: What editor to use in combination with octave?,
David Grundberg <=