3

lispy-flow almost does what I want. The problem is, though it descends into a parenthesized sexp, it does so only if that parenthesized sexp contains another parenthesized sexp. The fact that it skips over atoms is problematic: there are times when I want to go to the next sexp, regardless of whether it's parenthesized or a simple atom. lispy-forward doesn't do what I want because it won't descend into an s-expression. What I really need is something analogous to hitting Space in an info manual: i.e., keep going to the next node, even when that means descending a level. Perhaps I've just overlooked it, but I haven't seen anything like that in lispy. lispy-down isn't quite right because it skips over atoms.

forward-sexp is closer to what I want, I guess, as it won't skip atoms, but it doesn't descend into parenthesized sexp's. I guess I could live with this, since I can descend with lispy-flow, then use forward-sexp to move across the list, but forward-sexp isn't even provided by lispy. Is it consistent with "the lispy way" to rely upon it when using lispy?

On the subject of "the lispy way"... I see that lispy-ace-symbol can be used to mark (and position cursor on) a specific symbol within the list at point, and then j/k can be used to move the mark to different sexp's (including atoms) in the list. So perhaps I could get some of the functionality I need this way, though it seems a bit heavy-handed. I mean, if I'm planning to move a sexp around within the list, it makes sense, but if I just want to move cursor to an atom within a list (e.g., to modify a symbol, or perhaps to insert a new sexp just before or after it), I'll need to cancel the region mark, and perhaps reposition cursor to the other end of the atom before doing my editing. Also, there's the side-effect of changing the region, when all I wanted was to move the cursor. (Perhaps that's not really an issue. It may be only because I'm relatively new to emacs, but that sort of side-effect seemed problematic to me, if only from an aesthetic standpoint...)

So what's "the lispy way" to move cursor from outside a list to a specific element (possibly an atom) within the list for editing?

Drew
  • 75,699
  • 9
  • 109
  • 225
BPS
  • 193
  • 4

1 Answers1

2

The only way to navigate and manipulate atoms in lispy is to mark them with a region. This is because if the point is around the item and the region is not active, the alpha keys should self-insert instead of calling commands.

Sexps example

Start with (| is the point):

|(progn
  (foo)
  (bar))

Press fs to get:

(progn
  (bar)
  |(foo))

Equivalent atoms example

Start with:

|(list
 foo
 bar)

Press mijs to get (~ is the mark):

(list
 bar
 ~foo|)

Alternatively, 2ms works the same, since 2m marks the second element.

abo-abo
  • 13,943
  • 1
  • 29
  • 43
  • Understood. Neat! Didn't realize you could use a count with `m` that way. I had been using `a` to bring up the interactive mode that lets you select a list item by pressing the associated letter. Thanks! – BPS Sep 29 '16 at 12:18