calva
calva copied to clipboard
Add squeeze paredit action
puni; Emacs modern paredit alternative has puni-squeeze.
This action kills all S-expressions enclosed by the cursor and removes the surrounding parentheses.
It provides users with a simple, consistent, and predictable method for changing parentheses types.
I consider this action an extremely useful innovation that surpasses the current rewrap method, and I would like to implement it in Calva.
foo (bar|) baz
;; Call `puni-squeeze'
foo | baz
;; Type in a pair of brackets
foo [|] baz
;; Call `yank'
foo [bar|] baz
Note
Current Calva has too many "rewrap" commands.
- Calva Paredit: Rewrap "":
C-M-r C-M-q - Calva Paredit: Rewrap ():
C-M-r C-M-p - Calva Paredit: Rewrap []:
C-M-r C-M-s - Calva Paredit: Rewrap {}:
C-M-r C-M-c - Calva Paredit: Rewrap #{}:
C-M-r C-M-h
After including paredit.squeeze action, user just do 3 action;
- Do
paredit.squeeze(suggestC-M-r C-M-k; indicate "kill" current sibling S-exps) - Add paren as you want in normal way (and paredit insert corresponding close paren)
- Do paste in normal way; boom, you finally achieve "rewrap" S-exps.