unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* readline eats previous text on line
@ 2006-09-27 21:26 Jon Wilson
  2006-09-28  1:40 ` Kevin Ryde
  0 siblings, 1 reply; 16+ messages in thread
From: Jon Wilson @ 2006-09-27 21:26 UTC (permalink / raw)


Hi,
I'm trying to read user input (interactive) using guile.  I'd like to use 
(ice-9 readline), so that the user can use backspace and history and such. 
  I'd also like to have a prompt at the beginning of the line.  These last 
two desires seem to be incompatible, at least mod my best efforts.

For instance, please consider the following:

(use-modules (ice-9 rdelim) (ice-9 format) (ice-9 readline))
(activate-readline)

(define (test)
   (define str #f)
   (display "prompt: ")
   (let loop ((n 1000000))
         (if (not (zero? n)) (loop (1- n))))
   (set! str (read-line))
   (newline)
   (display str))

(test)

This prints "prompt: " on a line, and then after a short time, it is 
erased.  The mess with loop in the middle is of course a crufty time delay, 
without which I can't see "prompt: " at all before it disappears.  After it 
has disappeared, I can type whatever I like, and then press enter. 
Whatever I have typed is then printed as expected, on a new line.

This behavior is unchanged (except for how much text is actually read) when 
I substitute read-char or read in for read-line.

This behavior is gone when I remove (activate-readline).

However, without readline, as I said above, the user cannot backspace, 
which is a great annoyance.

Obviously, however, when the normal guile repl uses readline, it has a 
prompt which is not eaten.  How is this accomplished?

Regards,
Jon


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


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

* Re: readline eats previous text on line
  2006-09-27 21:26 readline eats previous text on line Jon Wilson
@ 2006-09-28  1:40 ` Kevin Ryde
  2006-09-28  1:50   ` Jon Wilson
  2006-09-28 21:08   ` Jon Wilson
  0 siblings, 2 replies; 16+ messages in thread
From: Kevin Ryde @ 2006-09-28  1:40 UTC (permalink / raw)
  Cc: guile-user

Jon Wilson <j85wilson@fastmail.fm> writes:
>
> This prints "prompt: " on a line, and then after a short time, it is
> erased.

It might be as simple as

	(readline "foo: ")

Not sure if that's meant to be documented, seems like a pretty
sensible usage, even if reading current-input-port might be usual.


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


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

* Re: readline eats previous text on line
  2006-09-28  1:40 ` Kevin Ryde
@ 2006-09-28  1:50   ` Jon Wilson
  2006-09-28  7:49     ` Neil Jerram
  2006-09-28 21:08   ` Jon Wilson
  1 sibling, 1 reply; 16+ messages in thread
From: Jon Wilson @ 2006-09-28  1:50 UTC (permalink / raw)
  Cc: guile-user

Hi Kevin,

> 	(readline "foo: ")

This gives an error.

(read-line (current-input-port) 'trim "foo: ")

does not give an error, but "foo: " is ignored.  The first two arguments 
are the port to read from and the handle-delim value.  Any further 
arguments seem to be completely ignored.  Sorry.

> 
> Not sure if that's meant to be documented, seems like a pretty
> sensible usage, even if reading current-input-port might be usual.

It would be nice if that were it, I agree.

Thanks,
Jon


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


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

* Re: readline eats previous text on line
  2006-09-28  1:50   ` Jon Wilson
@ 2006-09-28  7:49     ` Neil Jerram
  2006-09-29  0:47       ` Kevin Ryde
  0 siblings, 1 reply; 16+ messages in thread
From: Neil Jerram @ 2006-09-28  7:49 UTC (permalink / raw)
  Cc: guile-user, Kevin Ryde

Jon Wilson <j85wilson@fastmail.fm> writes:

> Hi Kevin,
>
>> 	(readline "foo: ")
>
> This gives an error.

I think what you need is (set-readline-prompt! "foo: ").  The reason
it's done this way, instead of by a parameter to `readline', is that
when readline is activated it applies to the input port as a whole,
such that any attempt to read from the port (which doesn't usually
involve an explicit `readline' call) will use readline.

Regards,
     Neil



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


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

* Re: readline eats previous text on line
  2006-09-28  1:40 ` Kevin Ryde
  2006-09-28  1:50   ` Jon Wilson
@ 2006-09-28 21:08   ` Jon Wilson
  1 sibling, 0 replies; 16+ messages in thread
From: Jon Wilson @ 2006-09-28 21:08 UTC (permalink / raw)
  Cc: guile-user

Hi Kevin,

> It might be as simple as
> 
> 	(readline "foo: ")
> 
> Not sure if that's meant to be documented, seems like a pretty
> sensible usage, even if reading current-input-port might be usual.

Sorry, I think I misunderstood you before.  I thought you had gotten 
confused between `read-line' and `readline'.  `readline' is not documented, 
so I thought it did not exist.  But, now that I actually try what you said 
instead of what I misinterpreted it as, sure enough, such a function does 
exist, and it works as expected.

Thanks,
Jon


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


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

* Re: readline eats previous text on line
  2006-09-28  7:49     ` Neil Jerram
@ 2006-09-29  0:47       ` Kevin Ryde
  2006-09-29 22:33         ` Neil Jerram
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Ryde @ 2006-09-29  0:47 UTC (permalink / raw)
  Cc: guile-user

Neil Jerram <neil@ossau.uklinux.net> writes:
>
> ... instead of by a parameter to `readline',

Is that readline function meant to be used?  I assume it's emulating
the C function of that name.  If you use it and no other input it
works does it?


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


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

* Re: readline eats previous text on line
  2006-09-29  0:47       ` Kevin Ryde
@ 2006-09-29 22:33         ` Neil Jerram
  2006-09-30 12:25           ` Neil Jerram
  0 siblings, 1 reply; 16+ messages in thread
From: Neil Jerram @ 2006-09-29 22:33 UTC (permalink / raw)
  Cc: guile-user

Kevin Ryde <user42@zip.com.au> writes:

> Neil Jerram <neil@ossau.uklinux.net> writes:
>>
>> ... instead of by a parameter to `readline',
>
> Is that readline function meant to be used?  I assume it's emulating
> the C function of that name.  If you use it and no other input it
> works does it?

Yes, it is meant to be used, and I believe it works.

Sorry if I was misleading on this before.  I've refreshed my memory
now about how all this fits together.  Basically (ice-9 readline)
combines two separable things.

1. One is the Scheme readline function, which basically just wraps the
C function.  This allows programs to call `readline' explicitly when
they want to, and on such occasions it makes perfect sense for the
program to specify the prompt, so the readline's first arg is a prompt
string.

2. The other is the idea of using readline automatically whenever
something needs to be read from the current input port.  This is what
the `activate-readline' proc does - it could equally well be named
`use-readline-for-current-input-port'.  For this feature you wouldn't
expect to see an explicit `readline' call anywhere, except deep down
in the definition of a soft port that replaces the current input port.
Program code continues to use non-readline-specific calls like `read',
`read-char' or `read-line', and the port uses readline to replenish
the port's input buffer when necessary.

My explanation of the thinking behind set-readline-prompt! applies to
(2).  In this case the program can't always predict when a readline
will happen, and it doesn't issue the readline call itself directly;
so set-readline-prompt! basically means "use so-and-so prompt if a
readline is needed".

Slightly confusingly, set-readline-prompt! does also set the default
prompt for an explicit `readline' call (1).  I think the overall
situation would be clearer if it didn't.

The bug which Jon has noted, about the effect of set-readline-prompt!
not lasting very long, is caused by the fact that Guile's REPL code,
when using readline, does a

  (set-readline-prompt! "guile>" "...")

before reading an expression from the REPL, and

  (set-readline-prompt! "" "")

after the read, thus losing whatever prompt the user might have
installed for their own (non-REPL) purposes.  This code should instead
save the existing prompts and restore them afterwards - I'll post a
patch for that soon.

Regards,
     Neil



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


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

* Re: readline eats previous text on line
  2006-09-29 22:33         ` Neil Jerram
@ 2006-09-30 12:25           ` Neil Jerram
  2006-10-03  0:15             ` Kevin Ryde
  2006-10-03  0:22             ` Kevin Ryde
  0 siblings, 2 replies; 16+ messages in thread
From: Neil Jerram @ 2006-09-30 12:25 UTC (permalink / raw)
  Cc: guile-user

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

> The bug which Jon has noted, about the effect of set-readline-prompt!
> not lasting very long, is caused by the fact that Guile's REPL code,
> when using readline, does a
>
>   (set-readline-prompt! "guile>" "...")
>
> before reading an expression from the REPL, and
>
>   (set-readline-prompt! "" "")
>
> after the read, thus losing whatever prompt the user might have
> installed for their own (non-REPL) purposes.  This code should instead
> save the existing prompts and restore them afterwards - I'll post a
> patch for that soon.

Patch is below.

Another thing that is likely to bite people in this area is the
concept of continuation input and need to use
`set-buffered-input-continuation?!'.  The right thing to do here is
either to call `(set-buffered-input-continuation?! port #f)' before
each new read, or to set the new-input and continuation prompts to the
same thing: `(set-readline-prompt! my-prompt my-prompt)'.

(This is pretty horrible, but I can't see any other way.  If anyone
has any better ideas, please suggest them!)

Regards,
     Neil

Index: readline.scm
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/guile-readline/ice-9/readline.scm,v
retrieving revision 1.5
diff -u -r1.5 readline.scm
--- readline.scm	17 Apr 2006 01:35:37 -0000	1.5
+++ readline.scm	30 Sep 2006 12:20:12 -0000
@@ -68,8 +68,8 @@
 ;;; Dirk:FIXME:: If the-readline-port, input-port or output-port are closed,
 ;;; guile will enter an endless loop or crash.
 
-(define prompt "")
-(define prompt2 "")
+(define new-input-prompt "")
+(define continuation-prompt "")
 (define input-port (current-input-port))
 (define output-port (current-output-port))
 (define read-hook #f)
@@ -77,8 +77,8 @@
 (define (make-readline-port)
   (make-line-buffered-input-port (lambda (continuation?)
                                    (let* ((prompt (if continuation?
-                                                      prompt2
-                                                      prompt))
+                                                      continuation-prompt
+                                                      new-input-prompt))
                                           (str (%readline (if (string? prompt)
                                                               prompt
                                                               (prompt))
@@ -125,7 +125,7 @@
 ;;; %readline is the low-level readline procedure.
 
 (define-public (readline . args)
-  (let ((prompt prompt)
+  (let ((prompt new-input-prompt)
 	(inp input-port))
     (cond ((not (null? args))
 	   (set! prompt (car args))
@@ -141,9 +141,9 @@
 	   args)))
 
 (define-public (set-readline-prompt! p . rest)
-  (set! prompt p)
+  (set! new-input-prompt p)
   (if (not (null? rest))
-      (set! prompt2 (car rest))))
+      (set! continuation-prompt (car rest))))
 
 (define-public (set-readline-input-port! p)
   (cond ((or (not (file-port? p)) (not (input-port? p)))
@@ -202,19 +202,22 @@
 	   (not (let ((guile-user-module (resolve-module '(guile-user))))
 		  (and (module-defined? guile-user-module 'use-emacs-interface)
 		       (module-ref guile-user-module 'use-emacs-interface)))))
-      (let ((read-hook (lambda () (run-hook before-read-hook))))
+      (let ((repl-read-hook (lambda () (run-hook before-read-hook))))
 	(set-current-input-port (readline-port))
 	(set! repl-reader
-	      (lambda (prompt)
-		(dynamic-wind
-		    (lambda ()
-                      (set-buffered-input-continuation?! (readline-port) #f)
-		      (set-readline-prompt! prompt "... ")
-		      (set-readline-read-hook! read-hook))
-		    (lambda () (read))
-		    (lambda ()
-		      (set-readline-prompt! "" "")
-		      (set-readline-read-hook! #f)))))
+	      (lambda (repl-prompt)
+		(let ((outer-new-input-prompt new-input-prompt)
+		      (outer-continuation-prompt continuation-prompt)
+		      (outer-read-hook read-hook))
+		  (dynamic-wind
+		      (lambda ()
+			(set-buffered-input-continuation?! (readline-port) #f)
+			(set-readline-prompt! repl-prompt "... ")
+			(set-readline-read-hook! repl-read-hook))
+		      (lambda () (read))
+		      (lambda ()
+			(set-readline-prompt! outer-new-input-prompt outer-continuation-prompt)
+			(set-readline-read-hook! outer-read-hook))))))
 	(set! (using-readline?) #t))))
 
 (define-public (make-completion-function strings)



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


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

* Re: readline eats previous text on line
  2006-09-30 12:25           ` Neil Jerram
@ 2006-10-03  0:15             ` Kevin Ryde
  2006-10-03  0:52               ` Kevin Ryde
                                 ` (2 more replies)
  2006-10-03  0:22             ` Kevin Ryde
  1 sibling, 3 replies; 16+ messages in thread
From: Kevin Ryde @ 2006-10-03  0:15 UTC (permalink / raw)
  Cc: guile-user

Neil Jerram <neil@ossau.uklinux.net> writes:
>
> Slightly confusingly, set-readline-prompt! does also set the default
> prompt for an explicit `readline' call (1).  I think the overall
> situation would be clearer if it didn't.

It's not too terrible, may as well leave it alone in case anyone's
nutted it out and is using it.

> The bug which Jon has noted, about the effect of set-readline-prompt!
> not lasting very long, is caused by the fact that Guile's REPL code,

It might have been from only using `display' to show a prompt, which
readline doesn't know and hence overwrites.

> ... This code should instead
> save the existing prompts and restore them afterwards

But yes, that'd be a good thing.

> Patch is below.

Looks pretty reasonable.

> (This is pretty horrible, but I can't see any other way.  If anyone
> has any better ideas, please suggest them!)

I guess the application has to say the boundaries somehow.


I wrote some words for the manual.  Readline functions to follow the
other readline bits, the buffered-input to go in the Guile Modules
section.


6.5.3 Readline Functions
------------------------

The following functions are provided by

     (use-modules (ice-9 readline))

   There are two ways to use readline from Scheme code, either make
calls to `readline' directly to get line by line input, or use
`activate-readline' to have readline for all input from
`current-input-port'.

 -- Function: readline [prompt]
     Read and return a line of input from the user and return it as a
     string (without a newline at the end).  PROMPT is printed as a
     prompt, or the default is the string set in `set-readline-prompt!'
     below.

          (readline "Type something: ") => "hello"

 -- Function: activate-readline
     Enable readline for all reading from `current-input-port' (*note
     Default Ports::), and also enable readline features in the
     interactive REPL (*note The REPL::).

          (activate-readline)
          (read-char)

     `activate-readline' works by changing `current-input-port' to a
     special soft port which calls the `readline' function above for
     input.  This means all the usual reading functions (`read',
     `read-char', etc) work as normal, but the user has the interactive
     editing features of readline.

 -- Function: set-readline-prompt! prompt1 [prompt2]
     Set the prompt string to print when reading input.  This is used
     when reading through `activate-readline', and is also the default
     prompt for the `readline' function above.

     PROMPT1 is the initial prompt shown.  If a user might enter an
     expression across multiple lines, then PROMPT2 is a different
     prompt to show further input required.  In the Guile REPL for
     instance this is an ellipsis (`...').

     See `set-buffered-input-continuation?!' (*note Line Buffered
     Input::) t indicate the boundaries of logical expressions
     (assuming of course an application has such a notion).




6.5.4 Line Buffered Input
-------------------------

The following functions are provided by

     (use-modules (ice-9 buffered-input))

   A buffered input port allows a reader function to return chunks of
characters, which are to be handed out on reading the port.  A notion
of when further input for an application level expression is maintained
too, and passed through to the reader.

 -- Function: make-buffered-input-port reader
     Create an input port which returns characters obtained from the
     given READER function.  READER is called (READER cont), and should
     return a string or an EOF object.

     The new port gives precisely the characters returned by READER,
     nothing is added, so if any newline characters or other separators
     are desired they must come from the reader function.

     The CONT parameter to READER is `#f' for initial input, or `#t'
     when continuing an expression.  This is an application level
     notion set with `set-buffered-input-continuation?!' below.  If the
     user has entered a partial expression then it allows the reader
     for instance to give a different prompt to show more is required.

 -- Function: make-line-buffered-input-port reader
     Create an input port which returns characters obtained from the
     specified READER function, similar to `make-buffered-input-port'
     above, but where READER is expected to be a line-oriented.

     READER is called (READER cont), and should return a string or an
     EOF object as above.  Each string is a line of input without a
     newline character, the port code inserts a newline after each
     string.

 -- Function: set-buffered-input-continuation?! port cont
     Set the input continuation flag for a given buffered input PORT.

     An application uses this by calling with a CONT flag of `#f' when
     beginning to read a new logical expression.  For example with the
     Scheme `read' function (*note Scheme Read::),

          (define my-port (make-buffered-input-port my-reader))

          (set-buffered-input-continuation?! my-port #f)
          (let ((obj (read my-port)))
            ...


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


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

* Re: readline eats previous text on line
  2006-09-30 12:25           ` Neil Jerram
  2006-10-03  0:15             ` Kevin Ryde
@ 2006-10-03  0:22             ` Kevin Ryde
  1 sibling, 0 replies; 16+ messages in thread
From: Kevin Ryde @ 2006-10-03  0:22 UTC (permalink / raw)
  Cc: guile-user

Neil Jerram <neil@ossau.uklinux.net> writes:
>
> +		(let ((outer-new-input-prompt new-input-prompt)
> +		      (outer-continuation-prompt continuation-prompt)

Could there be a way for an application to get the prompts back,
so it could do the same sort of save/restore too?


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


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

* Re: readline eats previous text on line
  2006-10-03  0:15             ` Kevin Ryde
@ 2006-10-03  0:52               ` Kevin Ryde
  2006-10-04 23:13               ` Kevin Ryde
  2006-10-05 23:35               ` Neil Jerram
  2 siblings, 0 replies; 16+ messages in thread
From: Kevin Ryde @ 2006-10-03  0:52 UTC (permalink / raw)
  Cc: guile-user

I wrote:
>
> ... some words for the manual.

What else should be described?

Extra options to `readline' for the input/output ports, or is that
only meant for the %readline level and only set-readline-input-port!
for the high level?

(readline-port) create/return the readline port?

Is it possible to set the history file to use?  An application will
want its own, not .guile_history.

Is there any reason not to export add-history and friends?

Writing a completion function came up here a while ago didn't it?
What was the theory on hooking something new in?


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


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

* Re: readline eats previous text on line
  2006-10-03  0:15             ` Kevin Ryde
  2006-10-03  0:52               ` Kevin Ryde
@ 2006-10-04 23:13               ` Kevin Ryde
  2006-10-05 23:06                 ` Neil Jerram
  2006-10-05 23:35               ` Neil Jerram
  2 siblings, 1 reply; 16+ messages in thread
From: Kevin Ryde @ 2006-10-04 23:13 UTC (permalink / raw)
  Cc: guile-user

This is what I ended up checking-in.


6.5.3 Readline Functions
------------------------

The following functions are provided by

     (use-modules (ice-9 readline))

   There are two ways to use readline from Scheme code, either make
calls to `readline' directly to get line by line input, or use the
readline port below with all the usual reading functions.

 -- Function: readline [prompt]
     Read a line of input from the user and return it as a string
     (without a newline at the end).  PROMPT is the prompt to show, or
     the default is the string set in `set-readline-prompt!' below.

          (readline "Type something: ") => "hello"

 -- Function: set-readline-input-port! port
 -- Function: set-readline-output-port! port
     Set the input and output port the readline function should read
     from and write to.  PORT must be a file port (*note File Ports::),
     and should usually be a terminal.

     The default is the `current-input-port' and `current-output-port'
     (*note Default Ports::) when `(ice-9 readline)' loads, which in an
     interactive user session means the Unix "standard input" and
     "standard output".

6.5.3.1 Readline Port
.....................

 -- Function: readline-port
     Return a buffered input port (*note Buffered Input::) which calls
     the `readline' function above to get input.  This port can be used
     with all the usual reading functions (`read', `read-char', etc),
     and the user gets the interactive editing features of readline.

     There's only a single readline port created.  `readline-port'
     creates it when first called, and on subsequent calls just returns
     what it previously made.

 -- Function: activate-readline
     If the `current-input-port' is a terminal (*note `isatty?':
     Terminals and Ptys.) then enable readline for all reading from
     `current-input-port' (*note Default Ports::) and enable readline
     features in the interactive REPL (*note The REPL::).

          (activate-readline)
          (read-char)

     `activate-readline' enables readline on `current-input-port'
     simply by a `set-current-input-port' to the `readline-port' above.
     An application can do that directly if the extra REPL features
     that `activate-readline' adds are not wanted.

 -- Function: set-readline-prompt! prompt1 [prompt2]
     Set the prompt string to print when reading input.  This is used
     when reading through `readline-port', and is also the default
     prompt for the `readline' function above.

     PROMPT1 is the initial prompt shown.  If a user might enter an
     expression across multiple lines, then PROMPT2 is a different
     prompt to show further input required.  In the Guile REPL for
     instance this is an ellipsis (`...').

     See `set-buffered-input-continuation?!' (*note Buffered Input::)
     for an application to indicate the boundaries of logical
     expressions (assuming of course an application has such a notion).

6.5.3.2 Completion
..................

 -- Function: with-readline-completion-function completer thunk
     Call `(THUNK)' with COMPLETER as the readline tab completion
     function to be used in any readline calls within that THUNK.
     COMPLETER can be `#f' for no completion.

     COMPLETER will be called as `(COMPLETER text state)', as described
     in (*note How Completing Works: (readline)How Completing Works.).
     TEXT is a partial word to be completed, and each COMPLETER call
     should return a possible completion string or `#f' when no more.
     STATE is `#f' for the first call asking about a new TEXT then `#t'
     while getting further completions of that TEXT.

     Here's an example COMPLETER for user login names from the password
     file (*note User Information::), much like readline's own
     `rl_username_completion_function',

          (define (username-completer-function text state)
            (if (not state)
                (setpwent))  ;; new, go to start of database
            (let more ((pw (getpwent)))
              (if pw
                  (if (string-prefix? text (passwd:name pw))
                      (passwd:name pw)     ;; this name matches, return it
                      (more (getpwent)))   ;; doesn't match, look at next
                  (begin
                    ;; end of database, close it and return #f
                    (endpwent)
                    #f))))

 -- Function: apropos-completion-function text state
     A completion function offering completions for Guile functions and
     variables (all `define's).  This is the default completion
     function.

 -- Function: filename-completion-function text state
     A completion function offering filename completions.  This is
     readline's `rl_filename_completion_function' (*note Completion
     Functions: (readline)Completion Functions.).

 -- Function: make-completion-function string-list
     Return a completion function which offers completions from the
     possibilities in STRING-LIST.  Matching is case-sensitive.


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


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

* Re: readline eats previous text on line
  2006-10-04 23:13               ` Kevin Ryde
@ 2006-10-05 23:06                 ` Neil Jerram
  0 siblings, 0 replies; 16+ messages in thread
From: Neil Jerram @ 2006-10-05 23:06 UTC (permalink / raw)
  Cc: guile-user

Kevin Ryde <user42@zip.com.au> writes:

> This is what I ended up checking-in.

This all looks great to me; sorry for not commenting earlier!

Regards,
     Neil



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


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

* Re: readline eats previous text on line
  2006-10-03  0:15             ` Kevin Ryde
  2006-10-03  0:52               ` Kevin Ryde
  2006-10-04 23:13               ` Kevin Ryde
@ 2006-10-05 23:35               ` Neil Jerram
  2006-10-06  0:03                 ` Kevin Ryde
  2006-12-01 20:24                 ` Jon Wilson
  2 siblings, 2 replies; 16+ messages in thread
From: Neil Jerram @ 2006-10-05 23:35 UTC (permalink / raw)
  Cc: guile-user

Kevin Ryde <user42@zip.com.au> writes:

> Neil Jerram <neil@ossau.uklinux.net> writes:
>>
>> Slightly confusingly, set-readline-prompt! does also set the default
>> prompt for an explicit `readline' call (1).  I think the overall
>> situation would be clearer if it didn't.
>
> It's not too terrible, may as well leave it alone in case anyone's
> nutted it out and is using it.

OK, agreed.

>> The bug which Jon has noted, about the effect of set-readline-prompt!
>> not lasting very long, is caused by the fact that Guile's REPL code,
>
> It might have been from only using `display' to show a prompt, which
> readline doesn't know and hence overwrites.

Good point.  I believe Jon's going to raise this (inability to do
readline starting from the column after the prompt) with the readline
people.

>> ... This code should instead
>> save the existing prompts and restore them afterwards
>
> But yes, that'd be a good thing.
>
>> Patch is below.
>
> Looks pretty reasonable.

Thanks; I've committed it now.

Regards,
     Neil



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


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

* Re: readline eats previous text on line
  2006-10-05 23:35               ` Neil Jerram
@ 2006-10-06  0:03                 ` Kevin Ryde
  2006-12-01 20:24                 ` Jon Wilson
  1 sibling, 0 replies; 16+ messages in thread
From: Kevin Ryde @ 2006-10-06  0:03 UTC (permalink / raw)
  Cc: guile-user

Neil Jerram <neil@ossau.uklinux.net> writes:
>
> Good point.  I believe Jon's going to raise this (inability to do
> readline starting from the column after the prompt) with the readline
> people.

I see there's an rl_already_prompted, though you still have to tell it
the prompt string to make redisplay work.

I suppose readline.scm could expose that variable if desired.  But
there's a gazillion global variables in readline, maybe some general
mechanism for setting/getting would be nice.


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


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

* Re: readline eats previous text on line
  2006-10-05 23:35               ` Neil Jerram
  2006-10-06  0:03                 ` Kevin Ryde
@ 2006-12-01 20:24                 ` Jon Wilson
  1 sibling, 0 replies; 16+ messages in thread
From: Jon Wilson @ 2006-12-01 20:24 UTC (permalink / raw)


Hi,
(non)Update on this old issue.

Neil Jerram wrote:
> Good point.  I believe Jon's going to raise this (inability to do
> readline starting from the column after the prompt) with the readline
> people.
I filed a bug report some time ago, since I was unable to find any sort 
of users mailing list.  I have never heard anything back.

Regards,
Jon


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


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

end of thread, other threads:[~2006-12-01 20:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-27 21:26 readline eats previous text on line Jon Wilson
2006-09-28  1:40 ` Kevin Ryde
2006-09-28  1:50   ` Jon Wilson
2006-09-28  7:49     ` Neil Jerram
2006-09-29  0:47       ` Kevin Ryde
2006-09-29 22:33         ` Neil Jerram
2006-09-30 12:25           ` Neil Jerram
2006-10-03  0:15             ` Kevin Ryde
2006-10-03  0:52               ` Kevin Ryde
2006-10-04 23:13               ` Kevin Ryde
2006-10-05 23:06                 ` Neil Jerram
2006-10-05 23:35               ` Neil Jerram
2006-10-06  0:03                 ` Kevin Ryde
2006-12-01 20:24                 ` Jon Wilson
2006-10-03  0:22             ` Kevin Ryde
2006-09-28 21:08   ` Jon Wilson

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).