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 #27 received at 30822 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Nitish <nitishch <at> protonmail.com>
Cc: "30822 <at> debbugs.gnu.org" <30822 <at> debbugs.gnu.org>
Subject: Re: bug#30822: 25.3; python-shell-send-defun sends only one line
Date: Fri, 06 Apr 2018 22:26:56 -0400
Nitish <nitishch <at> protonmail.com> writes:

>         (when (not arg)
> -         (while (and (forward-line -1)
> -                     (looking-at (python-rx decorator))))
> -         (forward-line 1))
> +         (while (and
> +                 ;; Make sure forward-line actually moves Point
> +                 (eq (forward-line -1) 0)
> +                 ;; If Point is at a decorator, loop.
> +                 ;; else, move one line down and exit the loop.
> +                 (or (looking-at (python-rx decorator))
> +                     (and (forward-line 1) nil)))))

Thanks.  You could drop the comments, since they just repeat what the
code is saying.  And, while I know it's fairly common to use `and' and
`or' like that to encode conditionals, perhaps using `if' directly would
minimize the temptation to rephrase it as an "if" statement in English.




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.