all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: 49822@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#49822: 28.0.50; python-shell-send functions show no output
Date: Thu, 26 Aug 2021 10:27:43 +0200	[thread overview]
Message-ID: <87k0k8wqyo.fsf@gmail.com> (raw)
In-Reply-To: <51fa5c12-53b4-ad92-505f-1896d955b68c@easy-emacs.de> ("Andreas Röhler"'s message of "Sun, 15 Aug 2021 08:41:45 +0200")

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

On Sun, 15 Aug 2021 at 08:41, Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:

> On 14.08.21 11:29, Augusto Stoffel wrote:
>> On Fri, 13 Aug 2021 at 18:44, Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:
>>
>>> Hmm, a buffer is not an interactive shell. Putting a print() around
>>> should do it.
>> I'm not sure I get your point.  Evaluating an expression should print
>> the result, no?  It's the P in REPL.
>
> Python's interactive prompt offers a slightly different behavior than
> running code through a plain Python interpreter.
>
> I understand the code in a buffer as something which is executed as a
> program. If you run a program by a python interpreter, if it outputs 
> something, that depends.

Well, maybe that depends a bit on the use-case and taste.  But I would
like "send to the shell" to be more or less equivalent to "copy and
paste in the shell buffer".  Other people would prefer this as well,
cf. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29592

Anyway, I played around a bit and it's not hard to recover the Jupyter
behavior where evaluating some statements returns the last value.  The
attached file showing how it works.  I think Elpy does something
similar, in fact.

I'm struggling a bit on how this could be integrated with python.el.
Just dropping these new commands there would be easy, but not ideal; one
should probably integrate more tightly with the existing python-shell
commands, say by introducing a 'python-sell-echo-result' defcustom.  But
then I feel tempted to change various other things I don't like about
the Python shell, in particular the use of temporary files (as opposed
to escaped strings) to transfer pieces of code, which is very slow via
Tramp.

By the way, I also dislike how the 'python-shell-send-*' functions
don't even print a newline on the shell buffer, so that you see
    ">>> >>> >>>"
instead of
    ">>>\n>>>\n>>>"
after calling them thrice.  This means (1) a result may be printed right
next to the input prompt ">>>", and (2) it's impossible to tell if the
inferior process is busy by looking at the relative position of the
point and prompt.


[-- Attachment #2: python-shell-eval.el --]
[-- Type: application/emacs-lisp, Size: 2504 bytes --]

  reply	other threads:[~2021-08-26  8:27 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210903122828.16890.65271@vcs0.savannah.gnu.org>
     [not found] ` <20210903122829.EAAC220B71@vcs0.savannah.gnu.org>
2021-09-03 23:04   ` master e32c7d2: Change Python eval to send directly instead of using temporary files Stefan Monnier
2021-09-04  9:49     ` bug#49822: " Augusto Stoffel
2021-09-04 13:52       ` Stefan Monnier
2021-09-04 13:52       ` bug#49822: " Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-05  6:13       ` Barton, Mark
2021-09-05  6:13       ` Barton, Mark
2021-09-05  7:46         ` bug#49822: " Augusto Stoffel
2021-09-05  8:10         ` Augusto Stoffel
2021-09-05 17:18           ` bug#49822: " Mark Barton
2021-09-05 17:33             ` Mark Barton
2021-09-05 17:46             ` Augusto Stoffel
2021-09-05 17:46             ` bug#49822: " Augusto Stoffel
2021-09-05  8:10         ` Augusto Stoffel
2021-09-05  7:41       ` Lars Ingebrigtsen
2021-09-05  7:41       ` Lars Ingebrigtsen
2021-09-05  7:41       ` bug#32042: " Lars Ingebrigtsen
2021-09-05 16:36       ` Andreas Schwab
2021-09-05 18:40         ` Augusto Stoffel
2021-09-06  7:43           ` Michael Albinus
2021-09-06  8:40             ` Andreas Schwab
2021-09-06 11:23               ` Michael Albinus
2021-09-06 11:53                 ` Andreas Schwab
2021-08-02 14:32                   ` bug#49822: 28.0.50; python-shell-send functions show no output dalanicolai
2021-08-02 15:11                     ` bug#49822: forgot link (and mentioned wrong user) dalanicolai
2021-08-02 15:17                     ` bug#49822: 28.0.50; python-shell-send functions show no output Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-04  7:18                     ` Lars Ingebrigtsen
2021-08-05 10:03                       ` dalanicolai
2021-08-12 14:57                       ` Augusto Stoffel
2021-08-13 11:10                         ` Lars Ingebrigtsen
2021-08-13 16:44                           ` Andreas Röhler
2021-08-14  9:29                             ` Augusto Stoffel
2021-08-15  6:41                               ` Andreas Röhler
2021-08-26  8:27                                 ` Augusto Stoffel [this message]
2021-08-26 14:09                                   ` Lars Ingebrigtsen
2021-08-28  9:28                                     ` bug#49822: [RFC PATCH] " Augusto Stoffel
2021-08-28 15:41                                       ` Lars Ingebrigtsen
2021-09-03  8:02                                         ` bug#49822: [PATCH] " Augusto Stoffel
2021-09-03 12:28                                           ` Lars Ingebrigtsen
2021-09-06 22:15                     ` bug#49822: master e32c7d2: Change Python eval to send directly instead of using temporary files Andy Moreton
2021-09-07  7:18                       ` Andreas Schwab
2021-09-06 12:00                   ` Michael Albinus
2021-09-06 16:08                     ` Augusto Stoffel
2021-09-06 16:08                     ` Augusto Stoffel
2021-09-07 17:37                   ` Augusto Stoffel
2021-09-07 17:48                     ` Eli Zaretskii
2021-09-07 17:59                       ` Augusto Stoffel
2021-09-07 18:19                         ` Eli Zaretskii
2021-09-07 17:59                       ` Augusto Stoffel
2021-09-07 18:13                       ` Augusto Stoffel
2021-09-07 18:31                         ` Eli Zaretskii
2021-09-07 19:00                           ` Augusto Stoffel
2021-09-07 19:16                             ` Eli Zaretskii
2021-09-08  7:02                               ` Michael Albinus
2021-09-08  7:02                               ` Michael Albinus
2021-09-07 19:16                             ` Eli Zaretskii
2021-09-07 18:31                         ` Eli Zaretskii
2021-09-07 18:13                       ` Augusto Stoffel
2021-09-07 17:48                     ` Eli Zaretskii
2021-09-08  3:17                     ` Barton, Mark
2021-09-08  5:09                       ` Augusto Stoffel
2021-09-08  7:50                     ` Lars Ingebrigtsen
2021-09-08 14:05                       ` Augusto Stoffel
2021-09-08 14:05                       ` Augusto Stoffel
2021-09-09 13:48                         ` Lars Ingebrigtsen
2021-09-08  7:50                     ` Lars Ingebrigtsen
2021-09-06 11:23               ` Michael Albinus
2021-09-06  8:40             ` Andreas Schwab
2021-09-06  7:43           ` Michael Albinus

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=87k0k8wqyo.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=49822@debbugs.gnu.org \
    --cc=andreas.roehler@easy-emacs.de \
    --cc=larsi@gnus.org \
    /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.