Re: Readline completion example?

Jean Louis <[email protected]> Tue, 14 Nov 2017 10:31:51 +0300
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
Hello Sam,

Thank you.

On Mon, Nov 13, 2017 at 09:34:09AM -0500, Sam Steingold wrote:
> > * Jean Louis <[email protected]> [2017-11-12 07:30:08 +0300]:
> >
> > In general, I wish to be able in simple manner to
> > provide completions by using CLISP native
> > sys::completion function or whatever is there for
> > the purpose of selection of available options.
> 
> This is what it already does.

It does so for the LIPS functions. I am working on
it to change it so that it gives me choice that I
need, for example choice of countries, or choice
of people's names or choice of company names.

> > And I find it essential on command line.
> 
> This, I think, is done by shell (e.g., bash),
> not CLISP.

I did not express myself well. I have something
like a command line in CLISP, awaiting commands,
so I can search for people, companies and edit
pages and it is type of personal information
management.

For example the below function is then giving me
completion of LISP functions, which is absolutely
not related.

It would be better that I have prompt with the
optional list of possible private completions.

Maybe if CLISP has sys::completion maybe there
could some *private-completion* variable which
could take a list to quickly change the default
completions to the private completions.

Jean

(defun prompt-read (prompt &optional default)
  ;; TODO input of numbers is not stringizied
  (if default
    (format *query-io* "~a (~a): " (string-capitalize prompt) default)
    (format *query-io* "~a: " (string-capitalize prompt)))
  (force-output *query-io*)
  (let* ((input (string-trim '(#\Space #\Newline #\Tab) (read-line *query-io*))))
    (if (zerop (length input))
      (if default default "")
      input)))

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