* bug#21193: 25.0.50; python-shell-buffer-substring adds bogus if True: to unindented line
@ 2015-08-05 11:04 Jorgen Schaefer
0 siblings, 0 replies; only message in thread
From: Jorgen Schaefer @ 2015-08-05 11:04 UTC (permalink / raw)
To: 21193
Hello!
The function `python-shell-buffer-substring' can get confused when it is
used to send a substring of a line. It tries to add if True: around an
indented piece of code to prevent indentation errors, but it fails at
detecting indented code correctly:
(with-temp-buffer
(insert "def foo():\n"
" print('a')\n")
(re-search-backward "print")
(python-shell-buffer-substring (point) (point-at-eol) t))
=>
"if True:
print('a')"
Note that the "print" line in the resulting code is not indented.
The expected result would be either "print('a')" or
"if True:\n print('a')".
Regards,
Jorgen
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-05 11:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-05 11:04 bug#21193: 25.0.50; python-shell-buffer-substring adds bogus if True: to unindented line Jorgen Schaefer
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).