Closed bymoz089 closed 2 years ago
You can do it by:
puni-kill-line(-backward)
then puni-splice
puni-raise
I don't like to put such "composed" commands into Puni unless people really use them daily.
Edited
Thanks for responding and for mentioning puni-kill-line
! Now the body of above functions have only two lines. It's ok to define that on a private config.
Would you consider to make the kill argument of puni-soft-delete
from puni-kill-line
and puni-backward-kill-line
a customizable option?
You did this already on other functions via the variable delete-active-region
.
Note: following source code is just for documentation for future readers.
(defun my-puni-splice-sexp-killing-backward ()
(interactive)
(puni-backward-kill-line)
(puni-splice))
For now I adviced
puni-soft-delete
to always operate with argument kill
set to nil
.
(defun my-puni-soft-delete-filter-kill-arg (orig-fun from to &optional strict-sexp style kill fail-action return-region)
(funcall orig-fun from to strict-sexp style nil fail-action return-region))
(advice-add #'puni-soft-delete :around #'my-puni-soft-delete-filter-kill-arg)
Well, actually using puni-kill-line
isn't a good idea. It can't deal with multi-line sexp:
(foo|
bar)
;; what you want for puni-splice-sexp-killing-forward
foo|
;; what it actually does
foo|bar
Your original implementation is quite clean. Seems you don't like to define complex commands in private config? Here's a two-line version:
(defun puni-splice-sexp-killing-forward ()
(interactive)
(delete-region (point) (puni-end-of-list-around-point))
(puni-splice))
I missed some convenience functions. Those functions delete some content of the current sexp before splicing. Maybe it is possible to include them (or better versions of them)?