[Top][All Lists]

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

Re: Comint: handle raw tab

From: Štěpán Němec
Subject: Re: Comint: handle raw tab
Date: Tue, 13 Sep 2011 15:51:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

On Tue, 13 Sep 2011 14:43:10 +0200
Stefan Monnier wrote:

>> First case scenario, unique completion:
>> Consider the only possible completion being "True".
>> In [1]: Tr
>> Then hit C-q TAB so a TAB gets inserted after it and evaled:
>> (comint-send-input t)
>> In a normal ipython shell the result of this causes the input to be expanded
>> to "True" which is the unique completion. On the comint buffer this causes
>> the input to remain frozen. Internally, the input *does* get updated since
>> when I hit RET after evaling the code above the out shows "True" but I
>> didn't find a way to update the current input accordingly. Is there any way
>> to achieve that?
> You're going to have to redirect the process's output to read the
> shell's output and then use it to fill the user's current input.
>> Second scenario, multiple completions available:
>> Consider now I have typed just T:
>> In [1]: T
>> Then hit C-q TAB so a TAB gets inserted after it and evaled:
>> (comint-send-input t)
>> Now interesting things happens, since ipython outputs the list of possible
>> completions I can get them with comint-output-filter-functions, the thing is
>> the buffer now looks like this:
>> In [1]: T
>> TabError       True       TypeError
>> And the only way I found to show the prompt again without sending "T" to the
>> process was sending a BREAK signal because comint-delete-input does not work
>> in that instance. Is there a better way to handle that?
> The better way (IMNSHO) is to catch the process output so it doesn't get
> inserted in the buffer, build a completion table from it, and then
> call the normal in-buffer completion code with it so it gets displayed
> in *Completions*.

IMO native tab completion for subprocess REPLs is a common enough need
that the basic machinery should be handled by Emacs itself, i.e.
probably the comint library. I'm somewhat surprised there is no such
code yet (or is there, outside Emacs perhaps?).


reply via email to

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