Subject: bug#11520: 24.1.50; delete-selection-mode conflicts with electric-pair-mode

From: Stefan Monnier <[email-masked]>
Date: Mon, 08 Oct 2012 18:25:00 -0400

> I proposed making delete-selection-pre-hook understand a function as
> one of the legitimate types. If it were a function, it gets called and
> its results would be interpreted as type, either: 'yank, 'kill,
> 'supersede, t, or nil.

> That way, electric-pair-mode can override the (put
> 'self-insert-command 'delete-selection ...) with its own function that

That's going in the right direction, but I have two problems with that:
- I don't want electric-pair-mode to decide of the whole
  self-insert-command behavior.  I.e. self-insert-command should have
  a `delete-selection' property that is not specific to
  electric-pair-mode, so that if someone implements some other
  post-self-insert-hook that also interacts with
  selection-selection-mode, they should be able to cooperate.
  IOW, we need self-insert-command's delete-section property to be a new
  function that runs a new hook on which electric-foo-mode can add their
  respective function.
- this new hook should be good enough for delete-selection-mode,
  obviously, but it should also be good enough for a replacement
  of delete-selection-mode that works differently.
  I guess the functions on that hook would mostly need to return
  a boolean indicating whether they're going to make use of the region.

        Stefan