GNU bug report logs - #30822
python-shell-send-defun can't send first line of buffer

Previous Next

Package: emacs;

Reported by: David Liu <daveliu <at> alum.mit.edu>

Date: Wed, 14 Mar 2018 20:13:02 UTC

Severity: minor

Tags: confirmed, fixed, patch

Found in versions 25.3, 26.1

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #13 received at control <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: David Liu <daveliu <at> alum.mit.edu>
Cc: 30822 <at> debbugs.gnu.org
Subject: Re: bug#30822: 25.3; python-shell-send-defun sends only one line
Date: Wed, 14 Mar 2018 20:22:10 -0400
retitle 30822 python-shell-send-defun can't send first line of buffer
tags 30822 + confirmed
found 30822 26.1
severity 30822 minor
quit

David Liu <daveliu <at> alum.mit.edu> writes:

> regarding the possible bug with python-shell-send-defun, it seems to
> *only* occurs if the python function starts on the very first line of
> the file. Otherwise, python-shell-send-defun works perfectly.

Indeed, there is an unconditional call to `forward-line', which makes it
impossible to for python-shell-send-defun to send the first line of the
buffer:

(defun python-shell-send-defun (&optional arg msg)
  [...]
    (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 (forward-line -1)
                     (looking-at (python-rx decorator))))
         (forward-line 1)) ; <-----------------------------------
       (point-marker))
      [...]





This bug report was last modified 7 years and 99 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.