Subject: bug#20897: 25.0.50; [python] sexp-movement are confusing

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 03 Feb 2022 22:11:04 +0100

Rasmus <[email-masked]> writes:

> Open test.py
>
> Insert something like this, ignoring point denoted by "{v,^} {1,...,5}".
>
> 4  5   6
> v  v   v
> def foo(x):
>    """return x as one"""
>
>     x = 1;
>
>     return(x)
>    ^      ^  ^
>    2      3  1
>
> Consider points 1,...,5.  At point 2 forward-sexp will go to point 1, at
> point 3 backward-sexp will go to point 2.  At point 1, sexp-backward will
> go to 4 rather than point 2 (as I would expect).  Likewise, at point 4,
> forward sexp goes to point 1 rather than 5.  At point five, everything is
> as I would expect, and {forward,backward}-sexp goes to 6 and 4.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Point movement at 2 has been fixed -- it now goes to 3 (in Emacs 29),
not 1.

As for the other points here -- that C-M-<right> at 4 shouldn't move to
1 -- I think that would be pretty surprising.  That is, these commands
(try to) move by semantic unit, which is ambiguous in languages like
Python, so people have differing opinions.  But as far as I can tell,
python-mode here works as designed, so I'm therefore closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no