Re: Readline completion example?
Sam Steingold <[email protected]> Wed, 15 Nov 2017 15:57:23 -0500
| Newsgroups | gmane.lisp.clisp.general |
|---|---|
| Message-ID | <[email protected]> |
> * Jean Louis <[email protected]> [2017-11-15 09:20:07 +0300]: > > On Tue, Nov 14, 2017 at 04:27:08PM -0500, Sam Steingold wrote: >> >> > * Jean Louis <[email protected]> [2017-11-14 10:31:51 +0300]: >> > >> > (defun prompt-read (prompt &optional default) >> >> Please try hg tip facilities described in >> https://clisp.sourceforge.io/beta/impnotes/terminal.html#readline-extend > > That is great, thank you, You are welcome. > can be good for the start. I think you will have to develop it yourself now. > I see it is to complete the single words nicely, > yet if there are words with spaces it is not > working as expected and it is not completing. This is because of readline limitations: --8<---------------cut here---------------start------------->8--- (let ((custom:*completion* (lambda (s b e) (print (list s b e)) nil))) (read-line)) foo b <TAB> ("foo b" 4 5) --8<---------------cut here---------------end--------------->8--- as you see, when you type "foo b" and hit TAB, readline asks you to complete the string "b"=(subseq "foo b" 4 5), not "foo b" as you expect. You are free to ignore the start and end arguments in your completion function, of course, but this is a fairly special-purpose circumstance. Feel free to copy and modify clisp/src/complete.lisp:make-completion. -- Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504 http://steingoldpsychology.com http://www.childpsy.net http://thereligionofpeace.com http://islamexposedonline.com http://no2bds.org Perl: all stupidities of UNIX in one. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ clisp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/clisp-list