Subject: 28.1; electric-pair-open-newline-between-pairs does not work with c-context-line-break

From: Sean Devlin <[email-masked]>
Date: Mon, 6 Jun 2022 18:16:47 -0400

The command c-context-line-break in cc-cmds.el does not seem to respect
the electric-pair-open-newline-between-pairs setting when
electric-pair-mode is enabled.

To reproduce:

1. Start Emacs with -Q
2. M-x erase-buffer, SPC to run the disabled command
3. M-x c-mode
4. M-x electric-pair-mode
5. Type an opening brace '{' and observe that a closing brace '}' is entered automatically
6. RET to enter a newline and observe that a second newline is entered
automatically per the electric-pair-open-newline-between-pairs setting
7. C-/ to undo
8. M-x c-context-line-break to enter a newline and observe that the
second newline was not added

I think the issue is that c-context-line-break calls newline without
running the post-self-insert-hook, i.e. it calls (newline) rather than
(newline 1 t).

Since this command seems intended as a context-aware replacement for
newline (the manual suggests binding it to RET), I believe that it
should respect the electric-pair-open-newline-between-pairs setting.

Thanks!

In GNU Emacs 28.1 (build 1, aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build 21A559))
of 2022-05-11 built on armbob.lan
Windowing system distributor 'Apple'
System Description:  macOS

Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS
TOOLKIT_SCROLL_BARS ZLIB

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

Major mode: C/*l

Minor modes in effect:
  electric-pair-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-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 epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils cl-extra seq byte-opt gv bytecomp byte-compile
cconv help-mode novice cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib
cus-start cus-load elec-pair iso-transl tooltip eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
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 emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads kqueue
cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 81493 6707)
(symbols 48 9331 1)
(strings 32 26161 1367)
(string-bytes 1 992832)
(vectors 16 17076)
(vector-slots 8 223432 9001)
(floats 8 27 38)
(intervals 56 241 0)
(buffers 992 11))