puni icon indicating copy to clipboard operation
puni copied to clipboard

feature idea: use one universal argument to force delete

Open holgerschurig opened this issue 3 years ago • 2 comments

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.

holgerschurig avatar Jan 25 '22 09:01 holgerschurig

Great idea!

AmaiKinono avatar Jan 26 '22 14:01 AmaiKinono

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:

  1. I personally bind puni-force-delete to C-h, which is easier to type and acts as DEL in a terminal. So to delete one char forward I can do C-f C-h.
  2. You can mark the char after and press DEL. Setting puni-confirm-when-delete-unbalanced-active-region suppresses the confirmation when this will cause an unbalanced state.

AmaiKinono avatar May 17 '22 14:05 AmaiKinono

I don't know if I'm missing something. If you know how to differ C-u from C-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

kljohann avatar Dec 01 '22 18:12 kljohann

Should be implemented, please test.

@kljohann Thanks for the tip!

AmaiKinono avatar Dec 03 '22 09:12 AmaiKinono