Bug#293235: [Pkg-octave-devel] Bug#293235: octave2.1-emacsen: hangs Emacs

Francesco Potorti` Francesco Potorti` <Potorti@isti.cnr.it>, 293235@bugs.debian.org
Tue, 15 Feb 2005 20:53:50 +0100


>| >  (defcustom inferior-octave-prompt
>| >    "\\(^octave\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ "
>| >    "*Regexp to match prompts for the inferior Octave process."
>| >    :type 'regexp
>| >    :group 'octave-inferior)
>| 
>| Hmm.  Why not simply "^[^>]+>+ "?
>
>That would probably be OK for most cases, though I'm sure some people
>reset the prompt to things that don't end with >.

Yes, but currently you assume that the prompt ends with ">+ ".  So why
not simplify the regexp and make it more general by simply changing it
to "^[^>]+>+ "?

With respect to the current default, it has the disadvantage that it
would be fooled by prompts containing more than one instance of '>', but
would have the advantage of matching anything that ends with ">+ ",
including all the prompts matched by the current regexp.

So I propose to change the default.

>| >Or perhaps we should arrange for the prompt to be set when the
>| >Octave process is started by Emacs?  
>| 
>| Anyway, setting PS1 inside .octaverc is useless with run-octave, because
>| PS1 is then reset to "octave> ".  Mh.  inferior-octave-startup does it.
>| Why?
>
>I'd guess the goal was to ensure that we could match the prompt.  

Well, it doesn't work, as my problem shows: if I set PS1 inside
.octaverc to something that is not matched by inferior-octave-prompt
then the filter hangs.

>But I'm no longer sure how all this is supposed to work.

And, sorry, I have not the time now to debug this :-(

Anyway, since it doesn't work, I make a second proposal:
until someone corrects it, from octave-inf.el remove the lines:

		  (if (not (string-equal
			    inferior-octave-output-string ">> ")) 
		      "PS1=\"\\\\s> \";\n")

>| >problem of people changing the prompt during a session.

>| In principle, the inferior octave mode could detect this and adjust
>| comint-prompt-regexp accordingly.

>How would you detect the change?

You can set comint to do something depending on the given command.  For
example, shell mode detects when the user uses the "cd" command, reads
its argument and changes the current directory accordingly.
shell-directory-tracker does it, but it is very complex: for octave it
should be much simpler.

-- 
Francesco Potort́ (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 313 8091
via G. Moruzzi 1, I-56124 Pisa         Email: Potorti@isti.cnr.it
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key