> 2. This appears a bit un-modular, since an externally supplied major  mode
> like SLIME has to worry about how CUA and delete-selection-mode  are
> implemented. It appears to be the right way to distinguish  commands that
> overwrite the selection (in these minor modes) from  others. But shouldn't
> calling self-insert-command (as slime-space  does) already take care of it?
> Wouldn't a `self-insert-command-hook'  be better than counting on
> pre-command-hook, which doesn't get called  e.g. if self-insert-command is
> not called interactively?

In theory, yes, in practice it's problematic because sefl-insert-command may
be called after having done some other work whose result may depend on
whether the region is deleted or not: so by the time you know to delete the
region, you've already run code which was affected by its presence.

Maybe delete-selection-mode could do what you propose: when
self-insert-command is called, it should kill the current command, delete
the region, and re-run the command that it just killed.  It's also bound to
risk introducing bugs.

So the only safe solution that I can think of is the one currently used.

Maybe it could be improved by making self-insert-command output a warning if
the region is active and delete-selection-mode is activated as well.


        Stefan


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to