GNU bug report logs -
#11974
24.1.50; python-nav-forward-sexp-function doesn't skip over strings
Previous Next
Reported by: Ivan Andrus <darthandrus <at> gmail.com>
Date: Wed, 18 Jul 2012 12:37:02 UTC
Severity: normal
Found in version 24.1.50
Done: Fabián Ezequiel Gallina <fabian <at> anue.biz>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Actually, the new function `python-nav-forward-sexp-function' doesn't do
what I expect at all. I use forward-sexp, up-list and friends a lot,
so perhaps I'm not typical. I do think sexp-like movement for python
would be AWESOME! Let me show some use cases where the current
functionality is broken for me, and then attempt to articulate what I
would like/expect. I shall always assume that forward-sexp has a
positive argument, and the obvious statements hold for negative
arguments.
In sage-mode we narrow to a docstring by doing the equivalent of
(let* ((bos (python-info-ppss-context 'string)))
(goto-char bos)
(forward-sexp 1)
(narrow-to-region bos (point)))
This is broken now since forward-sexp goes to the end of the block, far
past the end of the string (or not moving at all). If you have any
undindented code at the end of your buffer, then forward-sexp (and up-list)
will refuse to move past it e.g.
def main():
2+3 # I get stuck here
print main()
What I would expect form a "perfect" python forward-sexp is to skip over
a block if and only if you are at the very beginning of the block.
Otherwise is should skip over a statement if and only if you are at the
beginning of a statement. Otherwise is should act exactly as an
unmodified forward-sexp would, skipping over words, parenthesized
expressions, and strings.
I guess this is because I think of python as having a set of parens
around a block as well as parens around each statement in addition to
all parens and strings that are currently there.
I don't guarantee that this would be a good experience, but I think it
would. Hopefully up-list would then move to the end of the block etc.
I'm not sure how to deal with down-list. Perhaps going to the first
statement if it's at the beginning of a block and into a parenthesized
expression otherwise?
-Ivan
This bug report was last modified 12 years and 233 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.