Subject: bug#48837: Interaction between completion-moide and cc-mode new in 27.2

From: "John C. Ruttenberg" <[email-masked]>
Date: Fri, 4 Jun 2021 16:13:47 -0400

This bug occurs in 27.2 but not in 26.3

In a clean emacs "emacs -q --no-site-file":
1. Enable dynamic completion "(dynamic-completion-mode)"
2. Open a c++ source file
3. Text should be:

foo() {
  std::cerr <
  int i = static_cast<unsigned>(z);
}

   4. Position the cursor directly after the "<" and type "< " (two
characters "<" " "
   5. I get this error message: "Scan error: containing expression ends
prematurely, 22, 22"

In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
 of 2021-06-02 built on catb
Windowing system distributor 'AT&T Laboratories Cambridge', version
11.0.3332
System Description: Ubuntu 20.04.2 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading completions from file /home/ruttenberg/.emacs.d/completions . . .
Loading completions from file /home/ruttenberg/.emacs.d/completions . . .
Done.
You can run the command â€˜dynamic-completion-modeâ€™ with M-x dy-m RET
Loading completions from file /home/ruttenberg/.emacs.d/completions . . .
Done.
Error in pre-command-hook (completion-before-command): (scan-error
"Containing expression ends prematurely" 16 16)
symbol-before-point: Scan error: "Containing expression ends prematurely",
17, 17
Configured using:
 'configure --prefix=/opt/emacs-27.2'

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

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

Major mode: C++//l

Minor modes in effect:
  dynamic-completion-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
  blink-cursor-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
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils 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 cus-start cus-load completion 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 move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 76735 9686)
 (symbols 48 9655 1)
 (strings 32 23478 2066)
 (string-bytes 1 843632)
 (vectors 16 13035)
 (vector-slots 8 166467 11092)
 (floats 8 22 45)
 (intervals 56 208 3)
 (buffers 1000 14))