bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Simon Law
Subject: bug#11520: 24.1.50; delete-selection-mode conflicts with electric-pair-mode
Date: Sun, 21 Oct 2012 19:12:55 -0400

Attached is a patch against trunk.

I have addressed your concerns below:

On Mon, Oct 8, 2012 at 6:25 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> 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.

There is a new abnormal hook called delete-selection-self-insert-hooks
that delete-selection-mode attaches, by default, onto
self-insert-command and self-insert-iso.

Conceivably, the other functions may also need their own hooks, but I
couldn't think of a good use case right now. Therefore, YAGNI. It is
trivial to add this later.

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

Instead of booleans, those functions return one of the types that
delete-selection understands.

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

Attachment: 11520.0.patch
Description: Binary data


reply via email to

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