[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc
From: |
Stefan Monnier |
Subject: |
bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode |
Date: |
Fri, 21 Dec 2018 09:12:49 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>> Yes. What is happening, from the viewpoint of CC Mode, is that on
>> inserting a {, electric-pair-mode is prematurely inserting its }, before
>> the processing for the { is complete.
Since it's done from post-self-insert-hook, it's done at the very end of
inserting { so I'm not sure what you mean by "before the processing for
the { is complete".
>> Also, due to the way } gets inserted, the CC Mode processing for
>> the } isn't done at all.
I think you meant "due to the way CC-Mode hooks itself into the }
processing, ..." ;-)
>> Would it therefore be possible, rather than having a crude insertion on
>> post-self-insert-hook, to use something like post-command-hook to allow
>> the insertion of the { first to complete? Then, rather than using the
>> brutal self-insert-command for } in electric-pair--insert, use the
>> command to which the key } is bound?
Talking about brutal: how could electric-pair-mode run whichever command
is bound to } without taking the risk of running a much more brutal
command than one that inserts a character?
> FWIW, I think cc-mode should rather use post-self-insert-hook instead
> of redefining commands for keys whose expected behaviour is
> (with minor variations presumably covered by abundant hookage)
> self-insertion.
IIRC it should be able to just use electric-layout-mode for that (tho
maybe electric-layout's featureset doesn't currently cover 100% that of
CC-mode's auto-newline, in which case it would be nice to extend
electric-layout accordingly).
For things like electric-pair, electric-indent, and electric-layout to
work correctly together, they need to agree on some convention.
Note that CC-mode can also side-step that convention and use `insert`
instead of self-insert-command.
Stefan
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, Beatrix Klebe, 2018/12/18
- Message not available
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, Alan Mackenzie, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, João Távora, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode,
Stefan Monnier <=
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, Beatrix Klebe, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, João Távora, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, Beatrix Klebe, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, João Távora, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, João Távora, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, Beatrix Klebe, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, João Távora, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, João Távora, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, Alan Mackenzie, 2018/12/21
- bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode, João Távora, 2018/12/21