unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Setting the readline prompt ...
@ 2003-01-07 18:42 rm
  2003-01-08 18:04 ` Paul Jarc
  0 siblings, 1 reply; 6+ messages in thread
From: rm @ 2003-01-07 18:42 UTC (permalink / raw)
  Cc: guile-devel

Hello and a happy new year,

just a quick question: how can i change the readline
prompt (after readline is activated).
I found (set-readline-prompt! prompt . prompt2) in 
'ice-9 readline' but that does nothing more than

(define-public (set-readline-prompt! p . rest)
  (set! prompt p)
    (if (not (null? rest))
          (set! prompt2 (car rest))))

which of course doesn't really work since it doesn't affect
the prompts of the current repl.

BTW, i found '(set-repl-prompt! prompt)' which seems to be 
undocumented in the otherwise fine manual. How does this function
relate to the one from 'ice-9 readline' ?


tia Ralf Mattes
	  


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Setting the readline prompt ...
  2003-01-07 18:42 Setting the readline prompt rm
@ 2003-01-08 18:04 ` Paul Jarc
  2003-01-08 21:11   ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Jarc @ 2003-01-08 18:04 UTC (permalink / raw)
  Cc: guile-user

rm@fabula.de wrote:
> just a quick question: how can i change the readline
> prompt (after readline is activated).
> I found (set-readline-prompt! prompt . prompt2) in
> 'ice-9 readline'

AFAICT, set-readline-prompt! has no visible effect either in .guile or
in the REPL.

> BTW, i found '(set-repl-prompt! prompt)' which seems to be
> undocumented in the otherwise fine manual. How does this function
> relate to the one from 'ice-9 readline' ?

But this one works for me, even though I use readline.
Experimentation indicates you can use set-repl-prompt! from the REPL
and it will take effect immediately, or you can pass it a thunk which
returns a prompt string.


paul


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Setting the readline prompt ...
  2003-01-08 18:04 ` Paul Jarc
@ 2003-01-08 21:11   ` Neil Jerram
  2003-01-08 21:35     ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Neil Jerram @ 2003-01-08 21:11 UTC (permalink / raw)
  Cc: guile-user

>>>>> "Paul" == Paul Jarc <prj@po.cwru.edu> writes:

    Paul> rm@fabula.de wrote:
    >> just a quick question: how can i change the readline
    >> prompt (after readline is activated).
    >> I found (set-readline-prompt! prompt . prompt2) in
    >> 'ice-9 readline'

    Paul> AFAICT, set-readline-prompt! has no visible effect either in .guile or
    Paul> in the REPL.

It's a tricky business, prompting.

You can see the effect of set-readline-prompt! like this:

guile> (begin (set-readline-prompt! "1> " "2> ") (readline))
1> something
"something"
guile> (begin (set-readline-prompt! "1> " "2> ") (read))
2> something
something

The second case uses the secondary (continuation) prompt because the
(read) began by reading the trailing whitespace at the end of the
`(begin ...)' line.

So, in programs, you can use set-readline-prompt! to set whatever
prompt you like before reading some data.  It doesn't appear to work
at the REPL because the REPL itself does a set-readline-prompt! to set
the prompt to whatever was specified by the last set-repl-prompt!.

        Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Setting the readline prompt ...
  2003-01-08 21:11   ` Neil Jerram
@ 2003-01-08 21:35     ` Neil Jerram
  2003-01-08 21:47       ` Marius Vollmer
  0 siblings, 1 reply; 6+ messages in thread
From: Neil Jerram @ 2003-01-08 21:35 UTC (permalink / raw)
  Cc: guile-devel

>>>>> "Neil" == Neil Jerram <neil@ossau.uklinux.net> writes:

    Neil> You can see the effect of set-readline-prompt! like this:

    guile> (begin (set-readline-prompt! "1> " "2> ") (readline))
    1> something
    Neil> "something"
    guile> (begin (set-readline-prompt! "1> " "2> ") (read))
    2> something
    Neil> something

Er... except that there's a bug for which I'm just about the commit
the fix:

Index: readline.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/guile-readline/readline.c,v
retrieving revision 1.45
diff -u -r1.45 readline.c
--- readline.c  3 Nov 2002 22:09:20 -0000       1.45
+++ readline.c  8 Jan 2003 21:31:32 -0000
@@ -184,7 +184,7 @@
                      SCM_EOL);
     }
 
-  if (!((SCM_UNBNDP (outp) && SCM_OPINFPORTP (scm_cur_outp))
+  if (!((SCM_UNBNDP (outp) && SCM_OPOUTFPORTP (scm_cur_outp))
        || SCM_OPOUTFPORTP (outp)))
     {
       --in_readline;

Marius/Rob, should this go into the stable branch as well?

The symptom without this fix is:

guile> (readline)
ERROR: In procedure %readline:
ERROR: Output port is not open or not a file port
ABORT: (misc-error)

        Neil



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Setting the readline prompt ...
  2003-01-08 21:35     ` Neil Jerram
@ 2003-01-08 21:47       ` Marius Vollmer
  2003-01-08 23:52         ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Vollmer @ 2003-01-08 21:47 UTC (permalink / raw)
  Cc: Rob Browning

Neil Jerram <neil@ossau.uklinux.net> writes:

> Marius/Rob, should this go into the stable branch as well?

Yes.  (The way I understand it, it is a fix for something that didn't
work before at all, right?  It doesn't change existing behavior,
right?)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Setting the readline prompt ...
  2003-01-08 21:47       ` Marius Vollmer
@ 2003-01-08 23:52         ` Neil Jerram
  0 siblings, 0 replies; 6+ messages in thread
From: Neil Jerram @ 2003-01-08 23:52 UTC (permalink / raw)
  Cc: Rob Browning

>>>>> "Marius" == Marius Vollmer <mvo@zagadka.ping.de> writes:

    Marius> Neil Jerram <neil@ossau.uklinux.net> writes:
    >> Marius/Rob, should this go into the stable branch as well?

    Marius> Yes.  (The way I understand it, it is a fix for something
    Marius> that didn't work before at all, right?  It doesn't change
    Marius> existing behavior, right?)

That's my understanding too.

        Neil



_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-08 23:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-07 18:42 Setting the readline prompt rm
2003-01-08 18:04 ` Paul Jarc
2003-01-08 21:11   ` Neil Jerram
2003-01-08 21:35     ` Neil Jerram
2003-01-08 21:47       ` Marius Vollmer
2003-01-08 23:52         ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).