简体   繁体   中英

How to barf double quotes

I've got this as an initial state:

"first" second

Placing the cursor anywhere within the double quotes and pressing C-→ (in Emacs) gives me:

"first second"

Is there a "one-click" way to "barf" double quotes (ie to get back from the second state to the first)? I expected double quotes to work analogously to parenthesis barfing, but pressing C-← (while still having the cursor on the first word) doesn't seem to work (as it would in the case of parenthesis).

A potentially related question: Is there a way to remove the double quotes without prior making the length of their "span" zero.

Emacs 25.2 (9.0)

Major mode: Lisp

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption Column-Number Eldoc File-Name-Shadow Font-Lock Global-Eldoc Global-Font-Lock Global-Hl-Line Global-Linum Global-Rainbow-Delimiters Ido-Ubiquitous Line-Number Linum Mouse-Wheel Paredit Projectile Projectile-Global Rainbow-Delimiters Recentf Save-Place Shell-Dirtrack Show-Paren Tooltip Transient-Mark

There's no one-key command to do it. But you can get close: if the point is at the | in "first| second" , you can do MS CMd Ms:

  1. MS (paredit-split-sexp) to split it into "first"| " second" "first"| " second" ,
  2. CMd (paredit-forward-down) to descend into tho following string giving "first" "| second" , and then
  3. Ms (paredit-splice-sexp) to splice the content of the string giving "first" | second "first" | second .

To clean up the spaces you can then do M-SPC (just-one-space).

"first| second" MS (paredit-split-sexp) "first"| " second" "first"| " second" CMd (paredit-forward-down) "first" "| second"` Ms (paredit-splice-sexp) "first" | second "first" | second M-SPC (just-one-space) "first" |second

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