From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#25753: 25.2; Python mode shell interaction not working 100% Date: Tue, 28 Feb 2017 09:07:02 -0500 Message-ID: <87r32icsu1.fsf@users.sourceforge.net> References: <83lgt6xbr0.fsf@gnu.org> <87poifjsw2.fsf@users.sourceforge.net> <87poibgfyw.fsf@users.sourceforge.net> <87o9xtf0q6.fsf@users.sourceforge.net> <877f4efifx.fsf@users.sourceforge.net> <87innwe5wq.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488293938 17093 195.159.176.226 (28 Feb 2017 14:58:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Feb 2017 14:58:58 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 25753@debbugs.gnu.org To: charles@aurox.ch (Charles A. Roelli) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 28 15:58:53 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cijEk-0003KX-2k for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Feb 2017 15:58:46 +0100 Original-Received: from localhost ([::1]:33618 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cijEq-0004Tu-35 for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Feb 2017 09:58:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciiPn-0002Cm-Ac for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2017 09:06:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciiPi-0003Jv-L1 for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2017 09:06:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:32781) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciiPi-0003Jm-HR for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2017 09:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ciiPi-0007f6-6C for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2017 09:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Feb 2017 14:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25753 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25753-submit@debbugs.gnu.org id=B25753.148829075729441 (code B ref 25753); Tue, 28 Feb 2017 14:06:02 +0000 Original-Received: (at 25753) by debbugs.gnu.org; 28 Feb 2017 14:05:57 +0000 Original-Received: from localhost ([127.0.0.1]:59213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciiPd-0007en-9q for submit@debbugs.gnu.org; Tue, 28 Feb 2017 09:05:57 -0500 Original-Received: from mail-io0-f193.google.com ([209.85.223.193]:33108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciiPb-0007eZ-Sw for 25753@debbugs.gnu.org; Tue, 28 Feb 2017 09:05:56 -0500 Original-Received: by mail-io0-f193.google.com with SMTP id f84so1504866ioj.0 for <25753@debbugs.gnu.org>; Tue, 28 Feb 2017 06:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=hoF3XOIOjIBnblHggBJhX/tZJtvp81CiuzDQ9FK0Xy0=; b=I6bWPQx2vM8nbw2o+nis+FW7TecfDHt3fIbKXzeBYJyAS75SftPAOyeW+JJP9LSmN1 uTn4JJy/dBz6Gn3iiIeBfZGKchxj5BDk3ipdaX12MX2X/DOi7TK71LJ+hj07OG2Ozizv E3Xq6TDPCcHplnjEsgHyRkZ9xE2fXgdLGolaZj0gIH7S0Vqj3Dzy1/ZA0KynqefVm3xo QyXi1V8dVGci1ga2BGNVg425Kq+OFaJgbK+UGMA83YwOMqjOzNhtcR0pqHr0r8bJwf1Q MZnOi3OcqlSdJcrS8hquc6ohWhnLleVoJ7rhVfz3435q2H2u15HPchHinRp38A4bQFNc AaJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=hoF3XOIOjIBnblHggBJhX/tZJtvp81CiuzDQ9FK0Xy0=; b=j+wHzgbr894TkR/z+2gJSD/opFovwqHIG3Fs+71/jeV5vBHxLUEpZg9/pKhAVx9kRx tk4gZV+AR4wyac4zgHuYv5H3ULCLU79e6buweu/OGHDgTDFKFlOpbPJC40GonhYS+miK zndDu6VsV8CCT7hGs0YUmXIyPbDCKNZERQgi3ryORX7W+2i7QYIwBmP2pNW1Ge3oryma 2j2O+vbTklPBj+nBQxHx3G+AeT8PbdLHCNYXiaP+tl233GceQ3vubuO4M0ANnePbgCgd NrdK9Qa4WvY01aPQU2XD8tBXVtDOu4n5if2Eiy2IASe0QA4m3LIldlA6JiMBO3YL3X3E 3eyw== X-Gm-Message-State: AMke39kLUn4K6o0ba8YRInuc51KrG/mP9GNJCgX5mbUbYSdfXo8lF3Y2CbciLezEZfj6kQ== X-Received: by 10.107.162.194 with SMTP id l185mr3075462ioe.184.1488290750021; Tue, 28 Feb 2017 06:05:50 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id a4sm830628ioa.43.2017.02.28.06.05.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Feb 2017 06:05:49 -0800 (PST) In-Reply-To: (Charles A. Roelli's message of "Tue, 28 Feb 2017 11:34:12 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129942 Archived-At: charles@aurox.ch (Charles A. Roelli) writes: > using `python-shell-interpreter' and `cat | python $'. Python exited > immediately with code 126, so I guess this solution does not work here. > But I can't claim to understand any issues having to do with TTYs/"dumb > terminals", so maybe I am missing something. The equivalent for python.el would be approximately (defun my-python-shell-calculate-command (&rest _) "sh -c \"cat | python -i\"") (advice-add 'python-shell-calculate-command :override #'my-python-shell-calculate-command) But this breaks native completion and prompt detection, due to IO buffering I think. >>> So it would seem that `sudo easy_install >>> gnureadline' is the right thing to run. However that still does not fix >>> the issue because python2.7/lib-dynload/ comes before >>> python2.7/site-packages/ (where `gnureadline' is installed) in Python's >>> $PATH equivalent, `sys.path'. The solution, then, is to reorder the >>> path somehow or get `readline.so' out of the way (maybe by renaming it >>> -- cleaner suggestions welcome). >> >> I guess renaming should have the least amount of side-effects. > > Great. This is what works for me: > > cd /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload > mv readline.so readline.so.bak > > Hopefully we can add into emacs-25 a comment about this situation, > advising Mac OS X users to install `gnureadline' with `easy_install > gnureadline', then renaming `readline.so' to something not ending in > `.so', if the native completion does not work immediately. Does this look okay? --- i/etc/PROBLEMS +++ w/etc/PROBLEMS @@ -463,8 +463,25 @@ problem by adding this to your .cshrc file: unset edit stty -icrnl -onlcr -echo susp ^Z endif +*** In Inferior Python mode, input is echoed and native completion doesn't work. + + +This happens when python uses a libedit based readline module, which +is the default on macOS. This can be worked around by installing a +GNU readline based module instead, for example, using setuptools + + sudo easy_install gnureadline + +And then rename the system's readline so that it won't be loaded: + + cd /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload + mv readline.so readline.so.bak + +See for more details on +installation. + *** Emacs startup on GNU/Linux systems (and possibly other systems) is slow. This can happen if the system is misconfigured and Emacs can't get the full qualified domain name, FQDN. You should have your FQDN in the