[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#42319: 28.0.50; c-mode issue with electric-pair-mode
From: |
Alan Mackenzie |
Subject: |
bug#42319: 28.0.50; c-mode issue with electric-pair-mode |
Date: |
11 Jul 2020 10:26:53 -0000 |
User-agent: |
tin/2.4.4-20191224 ("Millburn") (FreeBSD/11.3-RELEASE-p9 (amd64)) |
Hello, Ergus.
In article <mailman.82.1594456263.2306.bug-gnu-emacs@gnu.org> you wrote:
> In c-mode there is an issue of adding some extra spaces in
> electric-pair-mode after class definitions.
> For example
> emacs -Q main.cxx
> M-x electric-pair-mode
> M-x c-toggle-auto-newline
> and then insert:
> class A {
> you should get: (# means the cursor)
> class A
> {
> #
> }
> now insert } and then you get
> class A
> {
>
> }
> #
> instead of:
> class A
> {
>
> }
> #
This happens because of the missing semicolon after the class. CC Mode
indents the otherwise empty line as a 'topmost-intro-cont line, since it
appears still to be within the class. One workaround for this is to
configure CC Mode not to insert a newline after this particular type of
brace. For example
(push '(class-close before) c-hanging-braces-alist)
, to try it out (it's a buffer local variable).
> The problem is actually worst if defun-close-semi is in c-cleanup-list
> because it doesn't work.
That surprises me. It works for me, here. What happens/fails to happen
in these circumstances?
> I need to remove the extra spaces first to make it work.
That indeed feels like a bug. Could you perhaps post your CC Mode
configuration (generated by C-c C-b), please, which should help me to
reproduce the bug.
> In GNU Emacs 28.0.50 (build 12, x86_64-pc-linux-gnu, X toolkit, cairo version
> 1.16.0, Xaw scroll bars)
> of 2020-07-10 built on ergus
> Repository revision: 7caf570662e41dd7cb90efaf8a335918cf1ac0da
> Repository branch: master
> System Description: Debian GNU/Linux 10 (buster)
[ .... ]
> Major mode: C++//la
> Minor modes in effect:
> electric-pair-mode: t
> tooltip-mode: t
> global-eldoc-mode: t
> electric-indent-mode: t
> mouse-wheel-mode: t
> tool-bar-mode: t
> menu-bar-mode: t
> file-name-shadow-mode: t
> global-font-lock-mode: t
> font-lock-mode: t
> auto-composition-mode: t
> auto-encryption-mode: t
> auto-compression-mode: t
> line-number-mode: t
> transient-mark-mode: t
> abbrev-mode: t
[ .... ]
--
Alan Mackenzie (Nuremberg, Germany).