all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: bea@klebe.blog
Cc: "João Távora" <joaotavora@gmail.com>, 33794-done@debbugs.gnu.org
Subject: bug#33794: 26.1; electric-pair-mode breaks auto-newline minor mode of cc-mode
Date: Tue, 15 Jan 2019 16:10:52 +0000	[thread overview]
Message-ID: <20190115161052.GA30619@ACM> (raw)
In-Reply-To: <20190101192729.GA22315@ACM>

Hello, Beatrix.

I have committed the patch from two weeks ago (to the Emacs master
branch), and I'm closing the bug as fixed.

-- 
Alan Mackenzie (Nuremberg, Germany).



On Tue, Jan 01, 2019 at 19:27:29 +0000, Alan Mackenzie wrote:
> Hello, Beatrix,

> Happy New Year!

> On Fri, Dec 21, 2018 at 11:00:10 -0500, Beatrix Klebe wrote:
> > What would be ideal, and what I'm looking for, is to get auto-pairing
> > of brackets with braces being placed where they should be
> > automatically and the insertion point getting put in between them at
> > the correct indent level, such as what happens with Visual Studio, or
> > Visual Studio Code, or several other editors with this functionality.
> > Perhaps it is not emacslike to have such behavior be totally
> > automated, but I am used to it and finds it decreases my ordinary
> > levels of frustration when working with verbose and imperative
> > languages. I am currently trying to write some insert specifiers for
> > smartparens to do this, but it is proving more difficult to find an
> > elegant solution than I had expected.

> I think the following patch to CC Mode gives you nearly everything you
> want, if not actually everything.

> It turned out that the amendment didn't require any modification to
> electric-pair-mode, so apologies to João.

> I don't know how much you've explored electric-pair-mode, but if the
> answer is "not very much", can I suggest you try setting
> electric-pair-skip-whitespace to 'chomp?  The following editing pattern
> is then available.  With electric-pair-mode and c-auto-newline mode
> enabled:

> ("|" represents point.)

> At the end of the line

>     if (foo)|
>     foo = bar;

> , type {.  This will give you something like:

>     if (foo)
>       {
>         |
>       }
>     foo = bar;

> .  Type in a statement ending with a semicolon:

>     if (foo)
>       {
>         foo = bar;
> 	|
>       }
>     foo = bar;

> .  Now type in }.  The effect is to "chomp" the space to the next }, and
> CC Mode's auto-newline then inserts an empty line after the brace:

>     if (foo)
>       {
>         foo = bar;
>       }
>     |
>     foo = bar;

> .  So, please try out the patch, and please let us all know how well it
> corresponds with what you were looking for.  Also please let me know
> about any bugs you notice, so that I can fix them.  Thanks for such an
> interesting problem!

> Here's the patch, which should apply cleanly to the emacs-26.1 source:

[ snip patch ].





  reply	other threads:[~2019-01-15 16:10 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
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 [this message]
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=20190115161052.GA30619@ACM \
    --to=acm@muc.de \
    --cc=33794-done@debbugs.gnu.org \
    --cc=bea@klebe.blog \
    --cc=joaotavora@gmail.com \
    /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.