bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Access to readline completions without line editing


From: Chet Ramey
Subject: Re: Access to readline completions without line editing
Date: Tue, 3 Oct 2023 16:35:11 -0400
User-agent: Mozilla Thunderbird

On 10/3/23 3:50 PM, Spencer Baugh wrote:

If you want to disable readline, then readline won't have any access to
the line editing data, and can't really do anything.

Yes, I said this badly.  readline would be enabled, since we'd be using
completions from it.  But Emacs would handle displaying the available
completions - somehow they would be communicated from readline to Emacs.

So readline would be reading the input and managing its line buffer?
Otherwise, how would it know the text to complete? Or are you suggesting
an API that takes the text as an argument?


That's why it would be nice to have an API to ask readline to trigger
completion, including application-specific completions.  Since those
completions are often not available any other way.

There are already APIs for this. It depends on what you want the end point
to be.

For instance, you could write yourself a wrapper function that temporarily
sets a display-matches hook, calls rl_complete_internal('?'), and gets
the list of matches to display. There is a single complicating factor to
this in that, under some circumstances, the display-matches hook will not
be called if there is only a single possible completion, but we can figure
out something for that. You could even bind it to a key sequence.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]