all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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 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.