aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorPer Starbäck2020-10-02 05:11:06 +0200
committerLars Ingebrigtsen2020-10-02 05:11:06 +0200
commitaac3effb8f3f870fc861eb62c67a8cb989cf74ac (patch)
tree442d87aad1f1d2ba616d49bea8e48b64101186cd /lisp/progmodes/python.el
parentacfbacefc468244911455fe6cd2abeabfddff312 (diff)
downloademacs-aac3effb8f3f870fc861eb62c67a8cb989cf74ac.tar.gz
emacs-aac3effb8f3f870fc861eb62c67a8cb989cf74ac.zip
python-shell-send-defun doesn't find the (whole) definition
* lisp/progmodes/python.el (python-shell-send-defun): Fix C-M-x for definitions like @property\ndef bar(): (bug#37828).
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el44
1 files changed, 23 insertions, 21 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 95b6a037bb3..3bdf46ddc41 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3200,27 +3200,29 @@ optional argument MSG is non-nil, forces display of a
3200user-friendly message if there's no process running; defaults to 3200user-friendly message if there's no process running; defaults to
3201t when called interactively." 3201t when called interactively."
3202 (interactive (list current-prefix-arg t)) 3202 (interactive (list current-prefix-arg t))
3203 (save-excursion 3203 (let ((starting-pos (point)))
3204 (python-shell-send-region 3204 (save-excursion
3205 (progn 3205 (python-shell-send-region
3206 (end-of-line 1) 3206 (progn
3207 (while (and (or (python-nav-beginning-of-defun) 3207 (end-of-line 1)
3208 (beginning-of-line 1)) 3208 (while (and (or (python-nav-beginning-of-defun)
3209 (> (current-indentation) 0))) 3209 (beginning-of-line 1))
3210 (when (not arg) 3210 (> (current-indentation) 0)))
3211 (while (and 3211 (when (not arg)
3212 (eq (forward-line -1) 0) 3212 (while (and
3213 (if (looking-at (python-rx decorator)) 3213 (eq (forward-line -1) 0)
3214 t 3214 (if (looking-at (python-rx decorator))
3215 (forward-line 1) 3215 t
3216 nil)))) 3216 (forward-line 1)
3217 (point-marker)) 3217 nil))))
3218 (progn 3218 (point-marker))
3219 (or (python-nav-end-of-defun) 3219 (progn
3220 (end-of-line 1)) 3220 (goto-char starting-pos)
3221 (point-marker)) 3221 (or (python-nav-end-of-defun)
3222 nil ;; noop 3222 (end-of-line 1))
3223 msg))) 3223 (point-marker))
3224 nil ;; noop
3225 msg))))
3224 3226
3225(defun python-shell-send-file (file-name &optional process temp-file-name 3227(defun python-shell-send-file (file-name &optional process temp-file-name
3226 delete msg) 3228 delete msg)