> I think it is clearer to catch the error than to check the property by > hand. But the question is where to do this? Where you did it, in > delete-selection-pre-hook, or where I did it, in delete-active-region? Honestly, mine was a simple-minded attempt to handle read-only buffers and read-only text analogously. > The question is, if you type a self-inserting character, is it right > to skip just the deletion done by delete-active-region and do the > insertion, or should it skip both? My patch does the former, yours > does the latter. I suppose your patch has the flaw that when `overwrite-mode' is on, the following part (if (and overwrite-mode (eq this-command 'self-insert-command)) (let ((overwrite-mode nil)) (self-insert-command (prefix-numeric-value current-prefix-arg)) (setq this-command 'ignore))))) will still cause an error and clear `pre-command-hook'. Maybe just add buffer-read-only and text-read-only to the handler in `delete-selection-pre-hook' as in the attached patch?