Skip to content

How to make sp-next-sexp or sp-forward-sexp never go up? #1232

@jgarvin

Description

@jgarvin

If I do a navigation command in one direction, I prefer that doing the opposite command always get me back to where I started, or at least somewhere on the same sexp I started on. sp-next-sexp and sp-forward-sexp (and their backwards equivalents) break this principle because they sometimes jump up and out of the current level. I'm sure some people like this behavior, but it would be nice if there was an option to control it.

In particular it makes it hard to reuse muscle memory from forward/backward word/symbol for forward/backward sexp.


(sp-forward-sexp &optional ARG)

Move forward across one balanced expression.

With ARG, do it that many times. Negative arg -N means move
backward across N balanced expressions. If there is no forward
expression, jump out of the current one (effectively doing
‘sp-up-sexp’).

(sp-next-sexp &optional ARG)

Move forward to the beginning of next balanced expression.

With ARG, do it that many times. If there is no next expression
at current level, jump one level up (effectively doing
‘sp-backward-up-sexp’).
Negative arg -N means move to the
beginning of N-th previous balanced expression.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions