unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Live System User <nyc4bos@aol.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 25753@debbugs.gnu.org, "Charles A. Roelli" <charles@aurox.ch>
Subject: bug#25753: 25.2; Python mode shell interaction not working 100%
Date: Sun, 19 Feb 2017 16:32:17 -0500	[thread overview]
Message-ID: <878tp1sw7y.fsf@aol.com> (raw)
In-Reply-To: <CAM-tV--Y3_COVU7-AbMJpHw1Jvg2+VWAvbcgcGmvf6sw1m6VFA@mail.gmail.com> (Noam Postavsky's message of "Sun, 19 Feb 2017 15:00:03 -0500")

Noam Postavsky <npostavs@users.sourceforge.net> writes:

> On Sun, Feb 19, 2017 at 2:39 PM, Live System User <nyc4bos@aol.com> wrote:
>>>
>>> Do you see this with 25.2-rc1 on GNU/Linux though?
>>
>>   Fedora doesn't have that version available currently.
>
> Can you try it after M-x load-library python RET and then evaluate
> this new definition of python-shell-completion-native-try:
>
> (defun python-shell-completion-native-try ()
>   "Return non-nil if can trigger native completion."
>   (let ((python-shell-completion-native-enable t)
>         (python-shell-completion-native-output-timeout
>          python-shell-completion-native-try-output-timeout))
>     (python-shell-completion-native-get-completions
>      (get-buffer-process (current-buffer))
>      nil "_")))

    I was already using that (wrapped in a "with-eval-after-load
    'python") from:

    https://github.com/jorgenschaefer/elpy/issues/887#issuecomment-275175119

    to no avail.

>
>>
>>   I did, however, look into the Python modules having to do with
>>   "readline"(completion).
>>
>>   I discovered that if I used the "readline" from "pyrepl.py"instead
>>   of the standard default one, then even though that warning still
>>   occured in a *Warning* buffer in Emacs, I never saw it -- I just
>>   saw   the *Python* buffer and my source buffer, as expected.
>
> I'm not sure what "pyrepl" is or to "use" it, but just looking at web
> search results, it seems to be connected to pypy, which is in the list
> of python-shell-completion-native-disabled-interpreters, could that be
> related?

  Not really but it makes allowances on whether or not pypy.py is
  currently loaded.

  Here is an important piece of pyrepl that appears to be revelent
  to how it deals with input and output from terminals (TTYs) and
  non-terminals:


    if '__pypy__' in sys.builtin_module_names:    # PyPy

        def _old_raw_input(prompt=''):
            # sys.__raw_input__() is only called when stdin and stdout are
            # as expected and are ttys.  If it is the case, then get_reader()
            # should not really fail in _wrapper.raw_input().  If it still
            # does, then we will just cancel the redirection and call again
            # the built-in raw_input().
            try:
                del sys.__raw_input__
            except AttributeError:
                pass
            return raw_input(prompt)
        sys.__raw_input__ = _wrapper.raw_input

    else:
        # this is not really what readline.c does.  Better than nothing I guess
        import __builtin__
        _old_raw_input = __builtin__.raw_input
        __builtin__.raw_input = _wrapper.raw_input

_old_raw_input = None


  I think that this related in the fact that the Emacs interaction is
  not with a real TTY (it doesn't have defined or tigetstr-retrievable
  terminal capabilities (curses) like how to do operations like "clear",
  "cup" or "horizontal" positioning).

  Thanks.





  reply	other threads:[~2017-02-19 21:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 16:07 bug#25753: 25.2; Python mode shell interaction not working 100% Charles A. Roelli
2017-02-16 17:54 ` Eli Zaretskii
2017-02-18 17:44   ` npostavs
2017-02-19 15:14     ` Live System User
2017-02-19 15:26       ` Noam Postavsky
2017-02-19 19:39         ` Live System User
2017-02-19 20:00           ` Noam Postavsky
2017-02-19 21:32             ` Live System User [this message]
2017-02-20  1:30               ` npostavs
2017-02-20 22:34                 ` Live System User
2017-02-21  1:46                   ` npostavs
2017-02-21  3:32                     ` Live System User
2017-02-21 13:35                       ` npostavs
2017-02-21 23:17                         ` Live System User
2017-02-22  1:40     ` npostavs
2017-02-22 19:43       ` Charles A. Roelli
2017-02-23 14:20         ` npostavs
2017-02-24 10:19           ` Charles A. Roelli
2017-02-25 14:11           ` Charles A. Roelli
2017-02-25 14:34             ` npostavs
2017-02-25 22:28               ` Charles A. Roelli
2017-02-27  2:14                 ` npostavs
2017-02-28 10:34                   ` Charles A. Roelli
2017-02-28 14:07                     ` npostavs
2017-02-28 15:56                       ` Eli Zaretskii
2017-03-01 23:00                         ` npostavs
2021-10-03 16:03 ` Carlos Pita
2021-10-03 16:31   ` Carlos Pita
2021-10-03 23:35     ` Carlos Pita
2021-10-03 23:55       ` Carlos Pita
2021-10-04  0:46         ` Carlos Pita
2021-10-04 15:05           ` Carlos Pita
2021-10-04  8:21         ` Augusto Stoffel
2021-10-04 15:31           ` Carlos Pita
2021-10-04 15:47             ` Augusto Stoffel
2023-08-11 17:55 ` bug#25753: 29.1; " Peter Mao
2023-08-25  5:32   ` Peter Mao
2023-08-25  6:31     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878tp1sw7y.fsf@aol.com \
    --to=nyc4bos@aol.com \
    --cc=25753@debbugs.gnu.org \
    --cc=charles@aurox.ch \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).