Fork me on GitHub

The zipper movement helpers don’t treat “uneval” nodes (rewrite-clj’s term for #_) as whitespace or comments. So, when navigating a zipper with “whitespace aware” helpers like z/right and z/next, you’ll make stops on uneval nodes. This surprised me and means a bunch of my code mishandles code with unevals in it. Are there any options besides creating my own version of rewrite-clj.node.extras/whitespace-or-comment? and duplicating everything that references it (directly or indirectly)? I’m OK with doing that, I just want to make sure it’s my best bet.


Hi @jacob.maine thanks for the question! This is a relatively common complaint/request of rewrite-clj. There I did take a crack at a generalized solution some time ago but found it more nuanced than I expected so have let it sit for now.


@lee, thanks for the link! That adds a lot of background. Do you recall the nuances of the generalized solution? Am I likely to run into anything in particular while creating my own versions of the movement functions? Or was the trouble more around fitting node skipping config into the general architecture of zipper construction? If you have more context, perhaps you could update the issue.


Hmmm… thanks @jacob.maine I thought I had added some notes on my attempt to that issue but it looks like I have not yet. I think you should be fine. The generalized solution was to skip nodes based on a user provided predicate. If I remember correctly, I was looking into what to do if all nodes ended up being skipped (and how that fits in with current implementation/behaviour), and how to handle a movement if the currently located inside a node that the predicate would skip. I’ll dig up my old notes and update the issue.


@lee thanks! Very helpful 🙏

👍 1