[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CUA/delete-selection-mode and remapped keys incompatibility

From: Stefan Monnier
Subject: Re: CUA/delete-selection-mode and remapped keys incompatibility
Date: Thu, 08 Feb 2007 17:45:38 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]