all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Per Starbäck" <per@starback.se>
To: Tomas Nordin <tomasn@posteo.net>
Cc: 37828@debbugs.gnu.org
Subject: bug#37828: 26.3; python-shell-send-defun doesn't find the (whole) definition
Date: Thu, 31 Oct 2019 07:32:06 +0100	[thread overview]
Message-ID: <CADkQgvs814QZ5-nzWOiEJsyrZAqR+UtOnGck2ZzghO-AR3CY4Q@mail.gmail.com> (raw)
In-Reply-To: <87imoene43.fsf@fliptop.i-did-not-set--mail-host-address--so-tickle-me>

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

> I think this is reported by Bug#30822 and fixed in master.

Thanks! Now I have had time to compare with the trunk. The first part
of the bug is indeed fixed, but not the second part:

Here is an updated patch made against the trunk. (There are only two new lines.)

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1819 bytes --]

$ diff -u python.el python-fixed.el
--- python.el	2019-10-30 21:42:17.569928936 +0100
+++ python-fixed.el	2019-10-31 07:23:50.087973158 +0100
@@ -3178,27 +3178,29 @@
 user-friendly message if there's no process running; defaults to
 t when called interactively."
   (interactive (list current-prefix-arg t))
-  (save-excursion
-    (python-shell-send-region
-     (progn
-       (end-of-line 1)
-       (while (and (or (python-nav-beginning-of-defun)
-                       (beginning-of-line 1))
-                   (> (current-indentation) 0)))
-       (when (not arg)
-         (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)
-           (end-of-line 1))
-       (point-marker))
-     nil  ;; noop
-     msg)))
+  (let ((starting-pos (point)))
+    (save-excursion
+      (python-shell-send-region
+       (progn
+         (end-of-line 1)
+         (while (and (or (python-nav-beginning-of-defun)
+                         (beginning-of-line 1))
+                     (> (current-indentation) 0)))
+         (when (not arg)
+           (while (and
+                   (eq (forward-line -1) 0)
+                   (if (looking-at (python-rx decorator))
+                       t
+                     (forward-line 1)
+                     nil))))
+         (point-marker))
+       (progn
+         (goto-char starting-pos)
+         (or (python-nav-end-of-defun)
+             (end-of-line 1))
+         (point-marker))
+       nil ;; noop
+       msg))))
 
 (defun python-shell-send-file (file-name &optional process temp-file-name
                                          delete msg)

  reply	other threads:[~2019-10-31  6:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-20  6:38 bug#37828: 26.3; python-shell-send-defun doesn't find the (whole) definition Per Starbäck
2019-10-24 19:21 ` Tomas Nordin
2019-10-31  6:32   ` Per Starbäck [this message]
2020-10-02  3:11     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADkQgvs814QZ5-nzWOiEJsyrZAqR+UtOnGck2ZzghO-AR3CY4Q@mail.gmail.com \
    --to=per@starback.se \
    --cc=37828@debbugs.gnu.org \
    --cc=tomasn@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.