GNU bug report logs -
#11520
24.1.50; delete-selection-mode conflicts with electric-pair-mode
Previous Next
Reported by: Simon Law <sfllaw <at> sfllaw.ca>
Date: Sat, 19 May 2012 20:10:01 UTC
Severity: normal
Found in version 24.1.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #48 received at 11520 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Attached is a patch against trunk.
I have addressed your concerns below:
On Mon, Oct 8, 2012 at 6:25 PM, Stefan Monnier <monnier <at> 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/
[11520.0.patch (application/octet-stream, attachment)]
This bug report was last modified 10 years and 359 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.