From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Fabian Ezequiel Gallina Newsgroups: gmane.emacs.devel Subject: Comint: handle raw tab Date: Mon, 12 Sep 2011 00:34:00 -0300 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec5304f4ba960eb04acb63219 X-Trace: dough.gmane.org 1315798451 30025 80.91.229.12 (12 Sep 2011 03:34:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 12 Sep 2011 03:34:11 +0000 (UTC) To: Emacs-Devel devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 12 05:34:08 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R2xHb-0007NZ-PI for ged-emacs-devel@m.gmane.org; Mon, 12 Sep 2011 05:34:08 +0200 Original-Received: from localhost ([::1]:37388 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2xHa-0002ME-R2 for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2011 23:34:06 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:45231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2xHY-0002M6-6G for emacs-devel@gnu.org; Sun, 11 Sep 2011 23:34:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2xHW-0007PS-Qe for emacs-devel@gnu.org; Sun, 11 Sep 2011 23:34:04 -0400 Original-Received: from mail-pz0-f44.google.com ([209.85.210.44]:57294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2xHW-0007P9-CI for emacs-devel@gnu.org; Sun, 11 Sep 2011 23:34:02 -0400 Original-Received: by pzk36 with SMTP id 36so6881493pzk.17 for ; Sun, 11 Sep 2011 20:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=y7oFOZHITHpVQdyHp7nUMhhOJYv3wdnPdsADBpod1J4=; b=l7qeje9+4e3yVjUpVaFIrm4oaByMa1GumLhnQNnFnNQyqYlKbLQ6nWFBXJ1Kwv0+Ll S++pd3i5PlY/9+gchgHvHOQPDa5zmPlQgOa5+bLeZLgOpADfwCJfREg1EDTMzL0+vHM8 jNZpRFk9SXrSBNrhJqmBOmfXF5NX4t0x9jBfc= Original-Received: by 10.68.60.193 with SMTP id j1mr2861786pbr.360.1315798440828; Sun, 11 Sep 2011 20:34:00 -0700 (PDT) Original-Received: by 10.68.65.134 with HTTP; Sun, 11 Sep 2011 20:34:00 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.44 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:143909 Archived-At: --bcaec5304f4ba960eb04acb63219 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 expande= d 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 i= s 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 th= e process was sending a BREAK signal because comint-delete-input does not wor= k 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 inferio= r shells implementations I know use comint so that makes me feel unsure about it. Regards, Fabi=E1n E. Gallina --bcaec5304f4ba960eb04acb63219 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello Emacs Devs,

I'm trying to send a raw tab to a comint proce= ss 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 sh= own.

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


First case sce= nario, unique completion:

Consider the only possible completion bein= g "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 o= f this causes the input to be expanded to "True" which is the uni= que completion. On the comint buffer this causes the input to remain frozen= . Internally, the input *does* get updated since when I hit RET after evali= ng the code above the out shows "True" but I didn't find a wa= y 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-se= nd-input t)

Now interesting things happens, since ipython outputs the list of possi= ble completions I can get them with comint-output-filter-functions, the thi= ng is the buffer now looks like this:

In [1]: T=A0=A0=A0
TabErro= r=A0=A0=A0=A0=A0=A0 True=A0=A0=A0=A0=A0=A0 TypeError=A0

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-in= put 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=20 inferior-python shell? Does it have any drawbacks?

The only thing I= can think of is having to rewrite the shell interactions (pydoc,=20 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=E1n E. Gallina

--bcaec5304f4ba960eb04acb63219--