This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Reading more than one expression on the same line


Maciej Stachowiak writes:

   Hi neil, first of all, if you have GNU diff, please send patches generated
   with diff -u (if you don't, a context diff like you sent is OK).

Will do.  (I now know that, when using C-x v = in Emacs, you can get
-u rather than -c by customizing the diff-switches variable.)

   It's interesting to note that this patch changes more than the case
   you mentioned. In particular, if you type a full expression and a
   partial expression on the same line, e.g.

   guile> 'foo '(bar

   foo will be displayed right away but you won't get another prompt.

Hmm, yes.  But you also (both before and after my patch) don't get
another prompt if you type just a partial expression:

guile> '(bar

So this is internally consistent, if perhaps unhelpful.  I think a more
generally helpful algorithm would be:

   (if (and (about-to-read)
            (not (char-ready?)))
       (display (if (reading-at-top-level)
                    top-level-prompt
                    continuation-prompt)))

But it needs to be applied at all levels of the reading code, not just
top level as at present, and so could adversely affect reading
performance.  (Also, I think it assumes that trailing whitespace after
the previously read expression has been consumed.)  It probably isn't
worth it.

(BTW, the behaviour with readline turns out to be inconsistent.  With
just a partial expression, guile prints the "..." continuation prompt
(correct IMO).  But with one full and one partial, guile prints the
"guile>" prompt.

guile> '(bar
... )
(bar)
guile> 'foo '(bar
foo
guile> )
(bar)

This feels like a straightforward bug, though.)

   This may be better than the current behavior, but it's something to
   be aware of.

I think my patch gives slightly less imperfect behaviour than the
current CVS.

Regards,

     Neil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]