unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* find s-expr in the REPL?
@ 2006-09-25  1:47 Daniel Llorens del Río
  2006-09-25  7:29 ` Neil Jerram
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Llorens del Río @ 2006-09-25  1:47 UTC (permalink / raw)



Hi,

I'd like to have the following key bindings in the REPL:

- like up-arrow, but shows previous s-expr instead of last line
- like ^R, but searches s-exprs instead of lines

Has somebody written readline macros to do these things? Any other way?

Thanks for any info,

	Daniel.



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


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

* Re: find s-expr in the REPL?
  2006-09-25  1:47 Daniel Llorens del Río
@ 2006-09-25  7:29 ` Neil Jerram
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Jerram @ 2006-09-25  7:29 UTC (permalink / raw)
  Cc: guile-user

Daniel Llorens del Río <daniel.llorensdelrio@epfl.ch> writes:

> Hi,
>
> I'd like to have the following key bindings in the REPL:
>
> - like up-arrow, but shows previous s-expr instead of last line

Just to check what you mean here: in many cases a line is a single
sexp, so there is no difference - so I presume you're talking about
the case where a sexp is split across lines, e.g.

guile> (define (foo)
guile>   (bar))

and saying that when you do up-arrow after this you'd like to see

guile> (define (foo) (bar))

Is that right?

> - like ^R, but searches s-exprs instead of lines

I think this is just a corollary of the above, isn't it?  In other
words, if you do "^R foo" you'd also like to see the combined line, as
shown just above.

It seems to me that these could most easily be achieved by modifying
what readline thinks its history is.  I'm sure this is doable, but
someone needs to look into the details.

> Has somebody written readline macros to do these things? Any other way?

I'm not familiar with readline macros.  Can they do this kind of line
combination?

Regards,
     Neil



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


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

* Re: find s-expr in the REPL?
       [not found] <0J6500HKIOS4MF@imap0.epfl.ch>
@ 2006-09-25 18:03 ` Daniel Llorens del Río
  2006-10-04 23:11   ` Kevin Ryde
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Llorens del Río @ 2006-09-25 18:03 UTC (permalink / raw)



On 25 Sep, 2006, at 18:07, guile-user-request@gnu.org wrote:

> Just to check what you mean here: in many cases a line is a single
> sexp, so there is no difference - so I presume you're talking about
> the case where a sexp is split across lines, e.g.
>
> guile> (define (foo)
> guile>   (bar))
>
> and saying that when you do up-arrow after this you'd like to see
>
> guile> (define (foo) (bar))
>
> Is that right?

Absolutely, that's what I mean. Actually, maybe I'd prefer up-arrow  
to show

guile> (define (foo)
...   (bar))

just as I would have typed it. But that's a minor detail.

> I think this is just a corollary of the above, isn't it?  In other
> words, if you do "^R foo" you'd also like to see the combined line, as
> shown just above.

That's right.

> It seems to me that these could most easily be achieved by modifying
> what readline thinks its history is.  I'm sure this is doable, but
> someone needs to look into the details.

The idea is, I guess, to have readline split its history not by  
newlines but by matching parentheses at the top level, at least when  
they cross line boundaries. I'll look into that, thanks.

> I'm not familiar with readline macros.  Can they do this kind of line
> combination?

I'm not familiar with them either. They seem to provide good search  
capabilities, so that's why I proposed them.



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


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

* Re: find s-expr in the REPL?
  2006-09-25 18:03 ` find s-expr in the REPL? Daniel Llorens del Río
@ 2006-10-04 23:11   ` Kevin Ryde
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Ryde @ 2006-10-04 23:11 UTC (permalink / raw)
  Cc: guile-user

Daniel Llorens del Río <daniel.llorensdelrio@epfl.ch> writes:
>
> Absolutely, that's what I mean. Actually, maybe I'd prefer up-arrow to
> show
>
> guile> (define (foo)
> ...   (bar))
>
> just as I would have typed it. But that's a minor detail.

I suspect readline can't display like that.

> The idea is, I guess, to have readline split its history not by
> newlines but by matching parentheses at the top level, at least when
> they cross line boundaries. I'll look into that, thanks.

The notion of input continuation is there, but at the moment
add-history is used for each line.  It ought to be just a matter of
holding lines until the start of the next continuation.

I'd think that could be just changed (don't bother with an option for
the current behaviour).  bash works multi-line this way for instance.


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


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

end of thread, other threads:[~2006-10-04 23:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <0J6500HKIOS4MF@imap0.epfl.ch>
2006-09-25 18:03 ` find s-expr in the REPL? Daniel Llorens del Río
2006-10-04 23:11   ` Kevin Ryde
2006-09-25  1:47 Daniel Llorens del Río
2006-09-25  7:29 ` 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).