Closed ROCKTAKEY closed 8 months ago
This is great! This will fix https://github.com/Fuco1/smartparens/issues/1115 and also, I believe https://github.com/Fuco1/smartparens/issues/1040 and https://github.com/Fuco1/smartparens/issues/1097 I've just tested it out on Emacs 29 and it seems to be working well there.
This used to work because those operations did not use destructive edits :/ But yes, nil is definitely safer. I don't know why I didn't go with that in the first place.
Actually, this seems to be even more complicated, because there now is a variable kill-ring-yank-pointer
which "points" to the kill ring, but if we replace the kill ring with nil, it will save a pointer to that locally bound list (since it's just a cons). So we now need to also nil-bind this variable to shadow its dynamic binding. I'm making a patch.
Thanks, great work!!!
Hi, I fixed the bug that
sp-delete-symbol
andsp-backward-delete-symbol
destructkill-ring
. Here is reproduction process:Explanation
Wrapping with
(let ((kill-ring kill-ring) (select-enable-clipboard nil)) ...)
is no mean, because thekill-*
commands destructively edit the list which globally bindskill-ring
, even withlet-bind
.kill-ring
is just a list. When list is passed to other variable, it is NOT copied but passed as reference. So thelet-bind
ingkill-ring
tokill-ring
does nothing, and destructive editing is not reverted. If we want to copy the list, you need to usepurecopy
.Therefore, we can fix this bug by
let-bind
ingkill-ring
to other list, likenil
.