]> git.eshelyaron.com Git - emacs.git/commitdiff
Tweak how `C-c C-r' computes the region in python-mode
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 27 Oct 2020 19:29:08 +0000 (20:29 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 27 Oct 2020 19:29:08 +0000 (20:29 +0100)
* lisp/progmodes/python.el (python-shell-buffer-substring): Don't
extend the region to the start of the line (bug#39398), but allow
sending the actual region as marked.

etc/NEWS
lisp/progmodes/python.el

index 71749d1b1ff19da6dbd31f74f69f2b6d07ca29d9..5e159480e0093d9fdabba0f8cb10067b7b03b8d7 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -239,6 +239,13 @@ the buffer cycles the whole buffer between "only top-level headings",
 \f
 * Changes in Specialized Modes and Packages in Emacs 28.1
 
+** Python mode
+
+*** 'C-c C-r' can now be used on arbitrary regions.
+The command previously extended the start of the region to the start
+of the line, but will now actually send the marked region, as
+documented.
+
 ** Ruby mode
 
 *** 'ruby-use-smie' is declared obsolete.
index 0487964d8157a6c8dfed52c8a2c4aef1f4fd5452..53542a75f58ca29d26ecb450d2614d55aaa9ff98 100644 (file)
@@ -3138,11 +3138,7 @@ the python shell:
      coding cookie is added.
   4. Wraps indented regions under an \"if True:\" block so the
      interpreter evaluates them correctly."
-  (let* ((start (save-excursion
-                  ;; Normalize start to the line beginning position.
-                  (goto-char start)
-                  (line-beginning-position)))
-         (substring (buffer-substring-no-properties start end))
+  (let* ((substring (buffer-substring-no-properties start end))
          (starts-at-point-min-p (save-restriction
                                   (widen)
                                   (= (point-min) start)))