質問

Is there an easy way to delete the smallest-possible non-atomic s-expression based on the cursor location? I want to turn this (the "|" is the cursor)

(defun foo (bar)
  (if bar
      |789
    (+ 456 123)))

into this

(defun foo (bar)
  |)

It seems like a useful thing to be able to do, but I couldn't find a relevant (one-step) command on the Paredit cheat sheet.

役に立ちましたか?

解決

I didn't find a predefined command either.

Fortunately, with Emacs it's really easy to implement your own.

For example:

(define-key global-map (kbd "C-c C-d") 
    (lambda () (interactive) (backward-up-list) (paredit-kill)))

他のヒント

C-M-u does the right thing inside strings in paredit 23, so `C-M-u C-M-k' will work even inside a string.

Assumed cursor is not at a number 789, but inside a string "Foo" at this place.

Than this command will fail.

That's why ar-kill-parentized-atpt and related extensions exist at

http://launchpad.net/s-x-emacs-werkstatt/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top