Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paredit kill right #1024

Closed
clyfe opened this issue Feb 9, 2021 · 5 comments
Closed

Paredit kill right #1024

clyfe opened this issue Feb 9, 2021 · 5 comments
Labels
paredit Paredit and structural editing

Comments

@clyfe
Copy link

clyfe commented Feb 9, 2021

Cont'd from #380.

Emacs paredit-kill effects in slightly different ways than either Calva's kill sexp or kill list.

In all examples that follow, killListForward outcome would be (a|).
Whereas paredit-kill has different behavior in each (it's more granular in its effects).

Example 1 - s-expresions

(a| b (c
       d) e)

+ paredit-kill = (expressions starting on the current line past the cursor are killed)

(a| e)

Example 2 - comments

(a| ;; comment
  e)

+ paredit-kill = (comment killed)

(a|
   e)

Example 3 - newline

(a|
  e)

+ paredit-kill = (newline killed)

(a| e)
@PEZ
Copy link
Collaborator

PEZ commented Feb 9, 2021

I like this!

I think that this is how VS Code's command Delete All Right should work in structural context. Well, if it kills to end of list when used from after example 3, at least:

(a| e)
=>
(a|)

We could consider binding the default shortcut for Delete All Right (ctrl+k on Mac) to this command when Paredit strict mode is on, and leave it default unbound otherwise.

I think the command could be named paredit.killForward. It is a bit unfortunate that these commands are named kill since it brings expectations about a kill ring, but let's keep it consistently wrong. 😑

Question. What should happen here?

(a b (c |d)
  e)

Maybe this:

(a b (c |)
  e)

And from there, this:

(a b |e)

Not sure. We could also refuse to kill anything...

@PEZ PEZ changed the title Paredit kill feature parity Paredit kill right Feb 9, 2021
@bpringe
Copy link
Member

bpringe commented Feb 9, 2021

I don't think the expression should ever kill outside the current list. So if run here, nothing should happen. Just my 2 cents.

(a b (c |)
  e)

@BetterThanTomorrow BetterThanTomorrow deleted a comment from clyfe Feb 9, 2021
@PEZ
Copy link
Collaborator

PEZ commented Feb 9, 2021

Yes, I tried this in Emacs now. It behaves as killListForward when there is no newline before the closing bracket. Makes sense.

@bpringe bpringe added enhancement paredit Paredit and structural editing labels Feb 9, 2021
@PEZ PEZ removed the enhancement label Feb 10, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Sep 7, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Sep 7, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Sep 7, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Sep 7, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Sep 8, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Sep 8, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Oct 3, 2021
xfthhxk added a commit to xfthhxk/calva that referenced this issue Oct 8, 2021
PEZ added a commit that referenced this issue Oct 20, 2021
@PEZ PEZ mentioned this issue Oct 20, 2021
12 tasks
@Kryptos-FR
Copy link

Kryptos-FR commented Oct 25, 2021

Could you consider changing the keyboard shortcut to something else than Ctrl+K. That key combination is already used by a lot of other shortcuts in VS Code, including (un)commenting code out (Ctrl+K, Ctrl+C, and Ctrl+K, Ctrl+U), collapsing code (Ctrl+K, [1-9]), etc.

Updating to that latest version of Calva killed my muscle memory/programming habit. And I'm sure it is also confusing to a lot of people.

Suggestion: replace the default with Ctrl+K, K.

@PEZ
Copy link
Collaborator

PEZ commented Oct 25, 2021

We're sorry about that. It's being tracked in #1356 and being worked on in #1358.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
paredit Paredit and structural editing
Projects
None yet
Development

No branches or pull requests

5 participants
@PEZ @clyfe @Kryptos-FR @bpringe and others