[emacs] Multiple cursor delete support

Fixes #2470
If you iterate backwards over the ranges (they are sorted), you won't have to do `listSelections` every time to access the current selection, and you protect yourself from weird corner cases, like if you have two cursors one char apart and deleting the character after the first removes the second, which I believe would result in an out-of-bounds array access and thus a null reference in the current code.