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

evil-sp-delete-line behavior #23

Closed
cmccloud opened this issue Aug 25, 2015 · 10 comments
Closed

evil-sp-delete-line behavior #23

cmccloud opened this issue Aug 25, 2015 · 10 comments

Comments

@cmccloud
Copy link

Using spacemacs, with evil, smart-parens, smart-parens-strict, and evil-smartparens enabled in an emacs-lisp buffer

(defun test-sexp ()
   |(sexp-A
     (A-first-child))
    (sexp-B)
    (sexp-C
     (C-first-child)
     (C-second-child)))

My expectation is that "D" should delete sexp-A and it's child, but leave sexp-B and sexp-C, instead D results in:

(defun test-sexp ()
    |)

Is this intended? Others are noticing the same behavior, the discussion is located syl20bnr/spacemacs#2747

@justbur
Copy link

justbur commented Aug 25, 2015

So the reason I see is here https://github.com/expez/evil-smartparens/blob/master/evil-smartparens.el#L80-L81. D goes up one sexp then backwards and down to find the deletion point.

@justbur
Copy link

justbur commented Aug 25, 2015

I would think a simple sp-forward-sexp would work here, but I'm probably not appreciating all of the possibilities.

@expez
Copy link
Owner

expez commented Aug 25, 2015

The readme is actually out of sync. I try to do readme driven development and this is what I first wanted, so I get the confusion. The docstring is correct, though, and says: "Emulate `sp-kill-sexp' with universal prefix."

In the example in the OP I usually do da(, but you could also call sp-kill-sexp.

My goal was to make something that was greater than the sum of its parts (evil and smartparens) and not just duplicate existing behavior across new keybindings.

@expez
Copy link
Owner

expez commented Aug 25, 2015

There's also evil-cleverparens to consider, it's quite similar to this package and the author is a great guy.

@cmccloud
Copy link
Author

thanks!

@expez
Copy link
Owner

expez commented Aug 25, 2015

To make it clear why I prefer to have it this way, and not like sp-kill-sexp:

(defun test-sexp () |(sexp-A (A-first-child)) (sexp-B) (sexp-C (C-first-child) (C-second-child)))

If I now it D I get:

(defun test-sexp () |)

which is quite handy!

@justbur
Copy link

justbur commented Aug 25, 2015

@expez Just a thought. In evil-sp--get-endpoint-for-sp-kill-sexp, what if this were the rule?

  1. Move to the eol
  2. up a sexp
  3. backwards and down a sexp

I think that handles both cases.

@justbur
Copy link

justbur commented Aug 25, 2015

Never mind. That would be weird in this case

  | (a (b 
)
)

@cmccloud
Copy link
Author

@expez I agree, and definitely see the usefulness here.

@expez
Copy link
Owner

expez commented Aug 25, 2015

You can also delete the sexp in the OP by doing d<sp-forward-sexp>. With the keybindings I've set up for myself this equates to dM-l. This variant also supports prefixes so by doing 2dM-l I can delete the following two sexps. Isn't it lovely when commands compose in this way? :)

@expez expez closed this as completed Aug 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants