emacs-diffs
[Top][All Lists]
Advanced

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

master 8c8349e: Tweak how `C-c C-r' computes the region in python-mode


From: Lars Ingebrigtsen
Subject: master 8c8349e: Tweak how `C-c C-r' computes the region in python-mode
Date: Tue, 27 Oct 2020 15:29:24 -0400 (EDT)

branch: master
commit 8c8349e4b57e9772b673cea2594f0a1e01a6f356
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Tweak how `C-c C-r' computes the region in python-mode
    
    * 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                 | 7 +++++++
 lisp/progmodes/python.el | 6 +-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 71749d1..5e15948 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -239,6 +239,13 @@ the buffer cycles the whole buffer between "only top-level 
headings",
 
 * 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.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 0487964..53542a7 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -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)))



reply via email to

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