简体   繁体   中英

Emacs Paredit: how to delete comment semicolons

Based on How do you comment out all or part of a Lisp s-exp using Paredit? I did CM-space then M-; and got, as expected, a commented-out S-exp:

;; (when window-system
;;     (sr-speedbar-open))

Now how do I delete those semicolons? When I try the obvious (backspace or delete), only one semicolon disappears. I also can't just undo, since I've done other stuff between adding the semicolons and wanting to delete them. I could also turn off paredit for this task, but I'm certain there's a more elegant way.

One thing you could do is re-select the region and then do M-; again, which will un-comment the given region if it's already commented. You could also try this function that I've put together which deletes backwards on a given line, while still preserving delimiters (it's basically a backwards paredit-kill ). You'd just navigate to the spot after the comment semicolons and then invoke paredit-backward-delete-line , preferably with whatever key binding that you bound it to (which was <C-backspace> in my above answer).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM