Subject: 28.0.50; c-mode issue with electric-pair-mode

From: Ergus <[email-masked]>
Date: Sat, 11 Jul 2020 10:30:13 +0200

--text follows this line--

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
{
  
}
#

The problem is actually worst if defun-close-semi is in c-cleanup-list
because it doesn't work. I need to remove the extra spaces first to make
it work.

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)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
main.cxx has auto save data; consider M-x recover-this-file
Electric-Pair mode enabled
You can run the command ‘c-toggle-auto-newline’ with C-c C-a
Undo [2 times]
Mark set
Making completion list...

Configured using:
 'configure --prefix=/home/ergus/.local/ --with-mailutils'

Configured features:
XPM JPEG TIFF GIF PNG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS
LUCID X11 XDBE XIM MODULES THREADS PDUMPER

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

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

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date subr-x seq mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
cus-start cus-load elec-pair cc-mode cc-fonts easymenu cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib
term/tmux term/xterm xterm byte-opt gv bytecomp byte-compile cconv
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 78618 7004)
 (symbols 48 9526 1)
 (strings 32 23498 1860)
 (string-bytes 1 844562)
 (vectors 16 10057)
 (vector-slots 8 107261 7421)
 (floats 8 26 435)
 (intervals 56 287 3)
 (buffers 992 12))