2

Using octave in a terminal window

x=1:10;
plot(x);

works fine, produces a plot window which is zoomable etc.

running octave under emacs, the plot appears, but the plot window is hung and you can't zoom. If you execute plot(x); again, the window disappears.

I'm using Debian Jessie, with GNU Emacs 24.3.1 and GNU Octave, version 3.8.1.

To get it to work at all I had to make a .octaverc to set the prompt.

$ cat ~/.octaverc
PS1(">> ")
6
  • Have you followed the "Appendix H Emacs Octave Support" gnu.org/software/octave/doc/interpreter/… ? In octave 3.8.1 there is a internal function fltk_draw which keeps the plot figure respondent. This is done by registering with add_input_event_hook within octaves commandline. I'm not an EMacs user but I think the above link addresses this. Commented Aug 23, 2014 at 16:59
  • @Andy, that sounds like a vital clue, but I can't find any reference to this. Can you give me a link? Commented Aug 24, 2014 at 11:26
  • Doesn't the link above guide you to the HTML page of the manual? Commented Aug 24, 2014 at 11:57
  • @Andy Yes, but there's nothing useful there. I meant a link to this fltk_draw function and its use to keep the plot figure responding. Commented Aug 24, 2014 at 12:21
  • This bug report? bugs.archlinux.org/task/40269 Commented Aug 24, 2014 at 14:09

1 Answer 1

3

It seems that the problem is caused by octave-mode running octave with the no-line-editing switch. You can just hack this out of the compiled lisp file and everything works fine!

On my system:

cd /usr/share/emacs/24.4/lisp/progmodes
sudo vi octave.elc

change --no-line-editing to --line-editing directly in the .elc file

restart emacs and everything should be fine.

Sign up to request clarification or add additional context in comments.

3 Comments

This is set with inferior-octave-startup-args, so just run customize-variable, make the appropriate change and save for future sessions. No need to edit emacs bytecode.
This solution freezes emacs until octave is killed.
Found the reason why it froze emacs, and it probably doesn't occur to everyone. Emacs was kept on a loop waiting for octave to print the prompt. Octave did print it but emacs didn't recognize it because it octave didn't start the line with it. It started it with an ANSI escape sequence for terminal bracketed-paste-mode because I had set enable-bracketed-paste on in my readline config. One can either remove that from the readline config or edit the prompt regex variable in emacs to fix the freezing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.