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

From: Simon Law <[email-masked]>
Date: Sun, 15 Jul 2012 12:33:37 -0400

On Sun, Jul 15, 2012 at 10:39 AM, Chong Yidong <[email-masked]> wrote:
> Simon Law <[email-masked]> writes:
>
>> I tested your fix and it makes electric-pair-mode insert pairs in the
>> right order now.
>>
>> But the bug is that delete-selection-mode destroys
>> electric-pair-mode's auto-wrapping ability. Unfortunately, your fix
>> does not address that.
>
> Hmm, I guess I misunderstood the bug.  I'll re-open it.
>
> Trying to work up a patch that does the right thing is not so
> straightforward, though, as electric-pair-post-self-insert-function does
> not have a simple triggering condition.

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
understands the triggering condition. The triggering condition would
be extracted from electric-pair-post-self-insert-function so it could
be used in two places.

Sound good?

P.S. I don't have an bzr checkout of Emacs right now. Would this be
something useful to target against Emacs 24 as a bugfix?

-- 
Cheers,
Simon - http://ca.linkedin.com/in/sfllaw/