GNU bug report logs - #29608
python.el movement functions

Previous Next

Package: emacs;

Reported by: Alex Branham <alex.branham <at> gmail.com>

Date: Thu, 7 Dec 2017 21:09:03 UTC

Severity: minor

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Glenn Morris <rgm <at> gnu.org>
To: Alex Branham <alex.branham <at> gmail.com>
Cc: 29608 <at> debbugs.gnu.org
Subject: Re: bug#29608: python.el movement functions
Date: Fri, 08 Dec 2017 12:56:44 -0500
Alex Branham wrote:

> Python movement statements do not always result in the behavior I'd
> expect. Consider this python file (with (|) representing point):
>
> (|)for i in [1, 2, 3]:
>     print(i)
>
> I'd expect M-x python-nav-forward-statement to result in
>
> for i in [1, 2, 3]:
>     print(i)
> (|)
>
> but instead you wind up with
>
> for i in [1, 2, 3]:
>     (|)print(i)

The actual result seems reasonable to me?

> and python-nav-forward-block (bound to M-e) is even worse. It results
> in point not moving at all:
>
> (|)for i in [1, 2, 3]:
>     print(i)

It seems that you disagree with python.el's definition of "statement" and
"block". Eg the block definition seems to be:

(defconst python-rx-constituents
  `((block-start          . ,(rx symbol-start
                                 (or "def" "class" "if" "elif" "else" "try"
                                     "except" "finally" "for" "while" "with"
                                     ;; Python 3.5+ PEP492
                                     (and "async" (+ space)
                                          (or "def" "for" "with")))
                                 symbol-end))





This bug report was last modified 3 years and 334 days ago.

Previous Next


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