puni
puni copied to clipboard
feature idea: use one universal argument to force delete
Hi, currently I can do C-c DEL to force one backward delete. There is no way for the force forward delete, e.g. a forced C-d.
Now, puni-delete-backward
and puni-delete-forward
understand prefix arguments. So if I prefix with 2, they will delete 2 characters. But prefixing with 1 would be identical to the non-prefixed version: delete one character only.
So my idea is that a prefix of one (e.g. a C-u) will turn on the force mode. That's IMHO easier to type than C-c DEL, and also we then get both backward-force-delete and forward-force-delete capability.
Great idea!
Sorry for the late response. I've looked into it and it seems pressing C-u
sends the argument 4
(which is the same as pressing C-u 4
). If we want to send 1
we have to press C-u 1
, which may not be easier to type than C-c DEL
.
I don't know if I'm missing something. If you know how to differ C-u
from C-u 4
, please tell me.
There are also other methods for force deleting, maybe you'll like one of them:
- I personally bind
puni-force-delete
toC-h
, which is easier to type and acts asDEL
in a terminal. So to delete one char forward I can doC-f C-h
. - You can mark the char after and press
DEL
. Settingpuni-confirm-when-delete-unbalanced-active-region
suppresses the confirmation when this will cause an unbalanced state.
I don't know if I'm missing something. If you know how to differ
C-u
fromC-u 4
, please tell me.
You can use “raw” prefix arguments via (interactive "P")
(instead of lowercase "p"
), as described here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Command-Arguments.html
Should be implemented, please test.
@kljohann Thanks for the tip!