all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Comint: handle raw tab
@ 2011-09-12  3:34 Fabian Ezequiel Gallina
  2011-09-13 12:43 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Fabian Ezequiel Gallina @ 2011-09-12  3:34 UTC (permalink / raw
  To: Emacs-Devel devel

[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]

Hello Emacs Devs,

I'm trying to send a raw tab to a comint process and handle it like it's
supposed.

The particular use case is the ipython shell: When you have typed the first
part of a python variable and hit TAB the name gets completed or a list of
possible completions is shown.

I tried several things in order to send the TAB to the comint process and
get the output to be handled but with no luck.


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?


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?

I noticed that running ipython with M-x ansi-term works flawlessly so I
started looking into its code for some ideas.

Would it be wrong to use term-mode instead of comint for an inferior-python
shell? Does it have any drawbacks?

The only thing I can think of is having to rewrite the shell interactions
(pydoc, pdbtrack, etc) I already have in python.el. However all the inferior
shells implementations I know use comint so that makes me feel unsure about
it.



Regards,
Fabián E. Gallina

[-- Attachment #2: Type: text/html, Size: 2336 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-09-26  1:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-12  3:34 Comint: handle raw tab Fabian Ezequiel Gallina
2011-09-13 12:43 ` Stefan Monnier
2011-09-13 13:51   ` Štěpán Němec
2011-09-13 15:23     ` Fabian Ezequiel Gallina
2011-09-13 18:19       ` Stefan Monnier
2011-09-26  1:30         ` Fabian Ezequiel Gallina
2011-09-13 15:20   ` Fabian Ezequiel Gallina

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.