bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49822: [RFC PATCH] python-shell-send functions show no output


From: Lars Ingebrigtsen
Subject: bug#49822: [RFC PATCH] python-shell-send functions show no output
Date: Sat, 28 Aug 2021 17:41:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Augusto Stoffel <arstoffel@gmail.com> writes:

> The main user-visible change is that now a result is printed in the
> shell in all possible cases, i.e.:
>
> 1. If the string being evaluated is a one-line expression.
> 2. If the string being evaluated is a multiline expression such as
>    "(1+\n1)".
> 3. The string being evaluated is contains multiple statements, the last
>    of which is an expression.  E.g., "x=1\nx".
>
> Currently, only case 1 prints a result (this is the actual topic of this
> bug).

Sounds like a definite improvement.  :-)

> This is a reasonably sensitive change and it would be good to collect
> feedback from others before merging it (a properly formatted patch will
> then follow).  In particular, since I'm not an expert in Python's
> internals, there might be some possible refinements to the
> __PYTHON_EL_eval function.  Is this perhaps a better topic for the
> emacs-devel list?

Yes, it might be a good idea to raise this topic on emacs-devel and see
if there's any feedback.

Some minor comments on the patch:

> +(defvar python-shell-eval-setup-code
> +  "\
> +def __PYTHON_EL_eval(source, filename):
> +    import ast, sys
> +    if sys.version_info[0] == 2:
> +        from __builtin__ import compile, eval, globals

I think it might be a better long-term maintenance solution to put the
Python code here (and from `python-shell-completion-native-setup') into
a .py file under etc (for instance in a new "python-mode"
sub-directory), and then read it in run-time (accessed via
`data-directory', which points to etc), and cache it in an internal
variable.

Editing Python that's inside a Lisp string is awkward.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]