From: charles@aurox.ch (Charles A. Roelli)
To: npostavs@users.sourceforge.net
Cc: 25753@debbugs.gnu.org
Subject: bug#25753: 25.2; Python mode shell interaction not working 100%
Date: Fri, 24 Feb 2017 11:19:46 +0100 [thread overview]
Message-ID: <m2y3wvriv1.fsf@aurox.ch> (raw)
In-Reply-To: <87o9xtf0q6.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Thu, 23 Feb 2017 09:20:01 -0500")
On Thu, Feb 23 2017 at 09:20:01 am, npostavs@users.sourceforge.net wrote:
> charles@aurox.ch (Charles A. Roelli) writes:
>>
>> Tested, and it has the same problem. Here is what *Python* normally
>> looks like at the start, run from M-x run-python in emacs -Q:
>>
>> Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 26 2016, 12:10:39)
>> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import codecs, os;__pyfile =
>>>>> codecs.open('''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py16611qgD''',
>>>>> encoding='''utf-8''');__code =
>>>>> __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py16611qgD''');exec(compile(__code,
>>>>> '''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py16611qgD''',
>>>>> 'exec'));
>> python.el: native completion setup loaded
>>
>> It seems like the line starting with ">>> " should not be printed, if
>> <nyc4bos@aol.com>'s test output is deemed to be running more or less
>> correctly. Maybe that can point us in the right direction?
>
> Hmm, it's odd, though since you're still getting the "setup loaded"
> message, the code *is* getting evaluated anyway, so it's likely that
> this problem is not directly related. Let's see if we can track it down
> anyway, try the loading the attached as
>
> emacs -Q -l py-trace-bad-output.el
>
> and see if anything shows up in *Messages*.
>
> (require 'python)
>
> (advice-add
> 'python-shell-make-comint :filter-return
> (lambda (proc-buffer-name)
> (with-current-buffer proc-buffer-name
> (add-hook 'after-change-functions
> (lambda (beg end len)
> (ignore-errors
> (save-excursion
> (save-match-data
> (when (string-prefix-p "import codecs" (buffer-substring beg end))
> (backtrace))))))
> nil t))
> proc-buffer-name))
>
> (run-python)
>
> (switch-to-buffer "*Python*")
> (display-buffer "*Messages*")
>
Here is what I got:
Loading ~/Downloads/py-trace-bad-output.el (source)...done
backtrace()
(progn (backtrace))
(if (string-prefix-p "import codecs" (buffer-substring beg end)) (progn (backtrace)))
(progn (if (string-prefix-p "import codecs" (buffer-substring beg end)) (progn (backtrace))))
(unwind-protect (progn (if (string-prefix-p "import codecs" (buffer-substring beg end)) (progn (backtrace)))) (set-match-data save-match-data-internal (quote evaporate)))
(let ((save-match-data-internal (match-data))) (unwind-protect (progn (if (string-prefix-p "import codecs" (buffer-substring beg end)) (progn (backtrace)))) (set-match-data save-match-data-internal (quote evaporate))))
(save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (if (string-prefix-p "import codecs" (buffer-substring beg end)) (progn (backtrace)))) (set-match-data save-match-data-internal (quote evaporate)))))
(progn (save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (if (string-prefix-p "import codecs" (buffer-substring beg end)) (progn (backtrace)))) (set-match-data save-match-data-internal (quote evaporate))))))
(condition-case nil (progn (save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (if (string-prefix-p "import codecs" ...) (progn ...))) (set-match-data save-match-data-internal (quote evaporate)))))) (error nil))
(lambda (beg end len) (condition-case nil (progn (save-excursion (let ((save-match-data-internal (match-data))) (unwind-protect (progn (if ... ...)) (set-match-data save-match-data-internal (quote evaporate)))))) (error nil)))(191 556 0)
comint-output-filter(#<process Python> "import codecs, os;__pyfile = codecs.open('''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py683UGH''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py683UGH''');exec(compile(__code, '''/var/folders/WP/WPe0Q1iAGc0J7iI6J50jcU+++TI/-Tmp-/py683UGH''', 'exec'));
")
accept-process-output(#<process Python> 1.0)
python-shell-accept-process-output(#<process Python> 1.0)
python-shell-completion-native-setup()
python-shell-completion-native-turn-on-maybe(t)
python-shell-completion-native-turn-on-maybe-with-msg()
run-hooks(python-shell-first-prompt-hook)
python-shell-comint-watch-for-first-prompt-output-filter(">>> ")
run-hook-with-args(python-shell-comint-watch-for-first-prompt-output-filter ">>> ")
comint-output-filter(#<process Python> ">>> ")
read-event(nil t 2)
sit-for(2)
execute-extended-command(nil "load-file" "load-file")
funcall-interactively(execute-extended-command nil "load-file" "load-file")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Shell native completion is disabled, using fallback
>>> Can you test the python code from python-shell-completion-native-setup
>>> outside of Emacs, e.g., save it to a file called 'native-completion.py'
>>> and then run 'python -i native-completion.py' and then type an
>>> underscore and hit <tab>.
>>
>> I get the following:
>>
>>>>> ___package__
>> __PYTHON_EL_native_completion_setup
>> __name__
>> __doc__
>> __import__
>> __debug__
>>
>> Interestingly, none of the dummy completions pop up.
>
> This seems to be the core of the problem. I gather that macOS uses
> libedit instead of readline by default, perhaps that is the source of
> incompatibility. Can you figure out how to change the python code so
> that the dummy completions do show up?
Yes, I will look into it.
next prev parent reply other threads:[~2017-02-24 10:19 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2y3wvriv1.fsf@aurox.ch \
--to=charles@aurox.ch \
--cc=25753@debbugs.gnu.org \
--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 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.