reddit / emacs

Package that treats prettified symbols (or other regions with a "display" attribute) as single chars for deletion

ChristopherHGreen ยท 2022-01-28 17:22
I use prettify-symbols mode heavily in my c++ code to map multicharacter operators to unicode. I also do things like map FLT\_MAX to the infinity symbol, "alpha" to the alpha symbol, etc. I would like to have it that when I use the delete or backspace key on such a symbol, that rather than deleting one character of the underlying ascii text, it would delete the whole region of text that has that display attribute. So, for instance, if I type "FLT\_MAX" and it maps to the unicode infinity symbol, backspace wouldn't delete the 'X' at the end of that string, but rather the whole word "FLT\_MAX". I think I can code something like that myself possibly, by looking at the display attribute of the text before the cursor, but was wondering if someone had already done this. Thanks for any help!