Fork me on GitHub

@cb.lists, about wordwise movement in comments and strings. You have that in strings already, right? In comments it is trickier, because most often I want to skip past comments when moving by sexpressions. Maybe we could do something about it when actually inside a comment…

Cris B09:02:12

Strings - not exactly, as punctuation doesn't seem to be treated as word boundaries as it is in text files. An example came up for me today editing Compojure routes - with all the / and : 'wordwise' movement jumps over the whole thing. Comments - yes I do mean strictly within the comment. It could be even tricker if you had something like an ignore form within a comment. Probably unfair to expect Calva to deal with that ... My typing self slips into a different mode when editing anything that feels more like text than a structured syntax tree, and I automatically edit as if I'm in a standard text field in a browser. I'm quite willing to believe I'm unusual in that respect!


I think we could add “when clause contexts” for if the cursor is in a string or a comment. Then people can use that to modify their keybindings. (So, then in the keybinding for forwardSexpr you could say !calva:inString to let the default keybindings kick in.

Cris B10:02:45

That sounds like a reasonable approach.

Cris B20:02:25

I know in general (& for good reasons) you're resistant to too many settings being added , and have no idea how many users feel like me about this. But if it's something you want to go ahead with, I'd be happy to scratch my own itch and put in an issue & PR (if I can figure out how to do it).


If we do this by adding contexts for cursor in string and in comment it wouldn’t add settings to Calva. It would be an API we need to keep adhering to, but it would be almost zero cost and the leverage for users is quite big. I would merge the PR without hesitation. I’m not sure where we would be managing the contexts, but I’d be happy to asses it together with you,. There are a some more cursor/structure contexts we can consider managing so it would be well invested time just to figure out the basic mechanism.

Cris B21:02:03

OK how about I add a github issue when I get a moment, and we discuss it further there.


Works for me!

Cris B04:02:37

OK I'm fairly clueless about how to proceed, but I'll make a bit of time late in the week to investigate.

Cris B00:02:40

@U0ETXRFEW & @U9A1RLFNV - I've added a PR for this. Happy to edit/rewrite/whatever if it steps on any toes. I've tested somewhat though I don't very easily stray from the happy path.

Cris B00:02:04

One thing I forgot to do was look at your test suite. If you typically keep it up with changes I'll need to add something there.


Awesome! I'm looking at it now


Super. Taking a look as well. Yes, this should be covered with some tests. I found a test pattern the other day that might come in handy. Will show you.


Left a comment on the PR now. Rather long, because these contexts really interests me. I hope it makes sense. 😃

Cris B08:02:43

Terrific, thanks @U0ETXRFEW - I shall read with interest (when I'm less cognitively challenged than I am this evening).


Evening, huh? Where in the world are you? 8PM… Jamaica?

Cris B09:02:49

Australia. Rural North NSW. A tad quieter than Jamaica ...


Haha. Of course. But you have to cope with walking upside-down. 😀


Phew, now I see that your map must be fake, because there is only two hours time difference between Kingston and Rural North.


paredit-kill != killListForward


What are you missing?


kill all forms that start after the cursor


* that start on the current line after the cursor


In maps/lets kills in pairs in they're on the same line


Also - kills comments


And is generally more useful, and it's what I want for my Alt+d


Would you mind providing before/after examples on that linked issue of what Calva's killListForward does and what you want this potentially other command to do so we can get a better idea? I do better with examples simple_smile


@U0ETXRFEW Your example 4 is already supported by both kill sexp and kill list. Should I leave it out? Or is it something I don't follow?