all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: bea@klebe.blog, 33794@debbugs.gnu.org,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode
Date: Fri, 21 Dec 2018 13:57:21 +0000	[thread overview]
Message-ID: <CALDnm501UKMaNGvNAs7wGKM9wOvJBOfO=2XK4s+a3NPetX0hcQ@mail.gmail.com> (raw)
In-Reply-To: <20181221134829.29135.qmail@mail.muc.de>

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

On Fri, Dec 21, 2018 at 1:48 PM Alan Mackenzie <acm@muc.de> wrote:

> Hello, Beatrix.
>
> In article <mailman.5894.1545155289.1284.bug-gnu-emacs@gnu.org> you wrote:
> > When using cc-mode, turning on electric-pair-mode causes the
> > auto-newline minor mode to stop inserting newlines where expected. This
> > is relevant to the formatting of C# code with the Allman/BSD brace style
> > in particular, though it would be nice if these modes specifically did
> > work together.
>
> 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.  Also, due to the way } gets
> inserted, the CC Mode processing for the } isn't done at all.
>
> @João: I think electric pair mode is intended to simulate the manual
> insertion of a matching paren, etc., when a paren, etc., is typed.
>
> 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?  This should allow CC Mode's
> auto-newline facility to work, and also more closely simulate the manual
> insertion of the closing delimiter.


I don't know.  We better ask Stefan (CC'ed) who I believe designed the
original strategy of inserting closing delimiters in the previous
electric-pair-mode. That didn't change in my redesign.

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.  If you place your specific cc-mode processing late
enough in the hook then its insertion will be "complete" for all
practical purposes.

João

[-- Attachment #2: Type: text/html, Size: 2569 bytes --]

  reply	other threads:[~2018-12-21 13:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 17:38 bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode Beatrix Klebe
     [not found] ` <mailman.5894.1545155289.1284.bug-gnu-emacs@gnu.org>
2018-12-21 13:48   ` Alan Mackenzie
2018-12-21 13:57     ` João Távora [this message]
2018-12-21 14:12       ` Stefan Monnier
2018-12-21 16:00         ` Beatrix Klebe
2018-12-21 18:49           ` João Távora
2018-12-21 19:06             ` Beatrix Klebe
2018-12-21 19:20               ` João Távora
2018-12-21 19:24                 ` João Távora
2018-12-21 19:43                 ` Beatrix Klebe
2018-12-22  1:08                   ` João Távora
2018-12-22  2:16                     ` João Távora
2018-12-22  2:41                       ` Alan Mackenzie
2018-12-22  3:22                         ` João Távora
2018-12-22  4:41                           ` Beatrix Klebe
2018-12-22 10:02                             ` João Távora
2018-12-22 12:33                           ` Alan Mackenzie
2019-01-01 19:27           ` Alan Mackenzie
2019-01-15 16:10             ` Alan Mackenzie
2018-12-21 20:11         ` Alan Mackenzie
2018-12-22  0:45           ` João Távora
2018-12-22 10:20             ` Alan Mackenzie
2018-12-22 13:47               ` João Távora
2018-12-21 21:50       ` Alan Mackenzie
2018-12-22 16:22         ` Stefan Monnier
2018-12-22 16:34           ` Beatrix Klebe
2018-12-22 17:12             ` Stefan Monnier
2018-12-22 17:34               ` Beatrix Klebe
2018-12-22 21:19                 ` João Távora
2018-12-22 22:15                   ` Alan Mackenzie
2018-12-22 22:55                     ` João Távora
2018-12-23 20:21                       ` Alan Mackenzie
     [not found]                       ` <20181223202143.GA6658@ACM>
2018-12-23 21:38                         ` João Távora
2018-12-23 21:46                           ` Alan Mackenzie
2018-12-28 12:44                           ` Alan Mackenzie
2018-12-23 14:43                     ` Stefan Monnier
2018-12-23 14:48   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALDnm501UKMaNGvNAs7wGKM9wOvJBOfO=2XK4s+a3NPetX0hcQ@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=33794@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=bea@klebe.blog \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.