]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix python-shell-send-defun at start of buffer (Bug#30822)
authornitishch <nitishchandrachinta@gmail.com>
Sat, 7 Apr 2018 03:15:03 +0000 (08:45 +0530)
committerNoam Postavsky <npostavs@gmail.com>
Sun, 8 Apr 2018 16:36:00 +0000 (12:36 -0400)
* lisp/progmodes/python.el (python-shell-send-defun): Handle the case
when we hit the beginning of buffer.

Copyright-paperwork-exempt: yes

lisp/progmodes/python.el

index afafd1b42cde03f88337be7435aad87349fbcfa9..adf7b33ccbb4fed31f46e35d60f8d911fedfbb85 100644 (file)
@@ -3163,9 +3163,12 @@ t when called interactively."
                        (beginning-of-line 1))
                    (> (current-indentation) 0)))
        (when (not arg)
-         (while (and (forward-line -1)
-                     (looking-at (python-rx decorator))))
-         (forward-line 1))
+         (while (and
+                 (eq (forward-line -1) 0)
+                 (if (looking-at (python-rx decorator))
+                     t
+                   (forward-line 1)
+                   nil))))
        (point-marker))
      (progn
        (or (python-nav-end-of-defun)