Re: Readline completion example?

Sam Steingold <[email protected]>
Newsgroups gmane.lisp.clisp.general
Message-ID <m1poiaxbdr.fsf@clr-sds>
Hi Jean,

> * Jean Louis <[email protected]> [2017-02-22 21:56:53 +0300]:
>
> How do I prevent the CLISP complainining on redefining the function?

without-package-lock
http://clisp.org/impnotes/pack-lock.html

1. you should be careful - the warning is there for a reason!

2. you now owe me a zorkmid (http://clisp.org/impnotes/faq.html#faq-fine)

> And which function I can use to get the string from the user?

sys::completion is hooked into clisp REPL.
iow, as soon as you modify it, clisp will use it.
be careful.

I suggest that you follow Pascal's advice.

IOW, you need something like this:

(defvar *original-completion* (fdefinition 'sys::completion))
(defun my-completion (string start end)
   (if entering database data
       do my database completion
       (funcall *original-completion* string start end)))
(setf (fdefinition 'sys::completion) #my-completion)

to recover:

(setf (fdefinition 'sys::completion) *original-completion*)

> Something similar like (read-line)?

exactly.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://mideasttruth.com
http://www.dhimmitude.org https://jihadwatch.org http://think-israel.org
Whom computers would destroy, they must first drive mad.

------------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.