It's good that ctrl-backspace in emacs will delete all whitespace. However, it doesn't stop there! It seems to only stop after it's deleted at least one word. This means, for example, that using it here:
foo(bar)
<cursor>
Results in
foo(<cursor>
Which is really dumb (IMHO)! The behavior I would want is something akin to the following:
- if there's whitespace preceding the cursor, delete all of the whitespace (then stop!).
- If there's a word preceding the cursor, delete the word.
- Otherwise, delete all adjacent repetitions of whatever character precedes the cursor.
This seems like a much more reasonable Ctrl-Backspace, but honestly, if I could just get (1), it would be a huge improvement. Is there a package for this, or a setting? I don't really know emacs lisp but maybe pointing me to where the relevant APIs are...
delete-word-or-whitespace
that I use -- feel free to modify the code to suit your precise needs -- I have designed it to not place anything in thekill-ring
: https://mcmap.net/q/961178/-emacs-delete-whitespaces-or-a-word – Shipowner