How can I configure overlay text to be read-only? I know there is a text property read-only, but that's not exactly what I want to use.
Asked
Active
Viewed 75 times
1 Answers
1
There is no predefined overlay property read-only.
You can probably get the behavior you want by using property keymap or local-keymap.
You can use a keymap value that binds all normally self-inserting keys to do nothing or raise an error.
If you do that only for what you know at overlay-creation time to be self-inserting keys then that might not be sufficient. You can instead bind all keys in that keymap to a command that does nothing (e.g. ignore) or that raises an error.
Someone else might have a better answer. But that's what I'd try first: use property keymap or local-keymap.
I also wonder what your actual use case is. Maybe this is an X-Y problem?
Drew
- 77,472
- 10
- 114
- 243
nilremoves the binding in that particular keymap (whatever keymap you bind it tonilin). If bound in another map that is active, it may still do something you don't want. Try binding it toignoreinstead ofnil. – Drew Mar 15 '20 at 15:50