GNU bug report logs -
#60142
28.1; python.el Incorrect region when python-shell-send-region from indented code
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
I wanted to give more details. But I basically get the same issue with
Emacs -Q and the default python console.
On Sun, 18 Dec 2022 at 11:38, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Date: Fri, 16 Dec 2022 23:54:23 +0100
> > From: pmercatoris <mercatorispierre <at> gmail.com>
> >
> > I am unable to get correct behavious when sending a region from indented
> code
> > to the python shell. Consider this python code:
> >
> > ```python
> > if True:
> > if True:
> > a = "test"
> > ```
> >
> > If I select the first `True` and `python-shell-send-region`, it will
> > correctly send it to the consol and print `True`.
> >
> > Now if I do the same thing with the second `True` it will throw an
> > error: `IndentationError: expected an indented block after 'if'
> > statement on line 1` Although it would also reffer to unexpected block
> > after `if` even it it were `for`, `try`, ...
> >
> > If I select the `a` or `a = "test"` it will correctly send it to the
> > console, however it won't echo the evaluation of the statement.
> >
> > If I select the string "test" and send, it will throw the same error as
> > the second True.
> >
> > My python config is very minimal:
> >
> > (use-package python
> > :ensure nil
> > :mode
> > ("\\.py\\'" . python-mode)
> >
> > :init
> > (setq-default indent-tabs-mode nil)
> >
> > :config
> > (setq python-indent-offset 4
> > python-indent-guess-indent-offset-verbose nil
> > )
> >
> > (setq python-shell-interpreter "jupyter"
> > python-shell-interpreter-args "console --simple-prompt"
> > python-shell-prompt-detect-failure-warning nil)
> >
> > (add-to-list 'python-shell-completion-native-disabled-interpreters
> > "jupyter"))
>
> Could you two please look into this? It sounds to me like Emacs works
> as expected here, but I'm not an expert on Python and our interfaces
> with it.
>
> Thanks.
>
[Message part 2 (text/html, inline)]
This bug report was last modified 2 years and 201 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.