Fork me on GitHub
#spacemacs
<
2017-07-31
>
eggsyntax17:07:19

Anyone aware of a way to delete a sexp? That is, to delete it without copying it to the kill-ring? Sometimes I just want something gone forever.

eggsyntax17:07:04

I’ve been trying to even come up with a way to do it with an emacs lisp fn…I haven’t found a way to kill-into-register, which would work; nor have I found a way to select a sexp (which would mean I could use delete-region).

alandipert19:07:12

eggsyntax to select lists anyway i frequently use % in visual mode

eggsyntax19:07:37

Yeah, that's what I'm currently doing for delete (along with delete-region). But it's not a true sexp operation like kill-sexp is (eg won't work for a keyword, even though a keyword is a valid sexp).

eggsyntax19:07:42

There's a sp-highlight-current-sexp command, but it seems to be a no-op for me.

alandipert19:07:24

eggsyntax as for elisp, perhaps a simple function that calls kill-sexp and then pops the kill ring?

eggsyntax19:07:34

Oh, hey, brilliant -- totally didn't think of that, I think that's exactly the optimal solution.

alandipert19:07:02

(defun delete-sexp ()

alandipert19:07:02

(interactive)

alandipert19:07:02

(evil-lisp-state-sp-kill-sexp)

alandipert19:07:02

(pop kill-ring))

alandipert19:07:59

my pleasure. thank you for the elisp opportunity :-)

eggsyntax19:07:46

Now bound to A-m (murder-sexp) and works like a charm 🙂

alandipert19:07:19

ha, excellent name

pesterhazy20:07:40

how did I not know about this channel ?!