Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs paredit - how to delete quotes

I'm using the emacs starter kit, https://github.com/technomancy/emacs-starter-kit, which comes with paredit mode. I'm writing some javascript, and would like to remove something from quotes. Eg. "somestring" should become somestring

What the best way to do that? Going in the other direction is easy, I just select somestring and type a quote.

Thanks.

like image 537
mark Avatar asked Apr 04 '11 18:04

mark


3 Answers

Use M-s to splice the current form into the outer form. This works with quotes, parentheses, and similar stuff, depending on the exact mode you're in:

(bla (|foo))  -> (bla |foo)
(bla "|foo")  -> (bla |foo)

Where | is the position of the cursor when you press M-s.

like image 69
Joost Diepenmaat Avatar answered Oct 18 '22 18:10

Joost Diepenmaat


If you're on the first quote, you can M-x delete-pair. If you do it all the time, bind that to some convenient key.

like image 31
scottfrazer Avatar answered Oct 18 '22 18:10

scottfrazer


Put point anywhere on the string and type M-s or M-x paredit-splice-sexp.

like image 6
Nietzche-jou Avatar answered Oct 18 '22 17:10

Nietzche-jou