Subject: bug#37547: CC Mode 5.33.2 (Dired by date); c-electric-backspace throws error `c-unfind-coalesced-tokens: Wrong type argument: integer-or-marker-p, nil`

From: "Sun, Wei" <[email-masked]>
Date: Sun, 29 Sep 2019 02:36:47 +0000

Package: cc-mode

$ cat test.cc
// 你好a

I want to delete the `a`, when press `backspace` after `a`, emacs will throw an error:

`c-unfind-coalesced-tokens: Wrong type argument: integer-or-marker-p,
nil`

the backtrace is:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  c-forward-sws()
  c-unfind-coalesced-tokens(6 7)
  c-before-change(6 7)
  delete-char(-1 nil)
  delete-backward-char(1 nil)
  backward-delete-char-untabify(1)
  c-electric-backspace(nil)
  funcall-interactively(c-electric-backspace nil)
  call-interactively(c-electric-backspace nil nil)
  command-execute(c-electric-backspace)

what's more, if you are visiting a large c++ file, after this error
occurs, then everything will become very slow.

Package: cc-mode

Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2019-09-05
Package: CC Mode 5.33.2 (Dired by date)
Buffer Style: nil
c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties 1-bit)

current state:
==============
(setq
 c-basic-offset 'set-from-style
 c-comment-only-line-offset 'set-from-style
 c-indent-comment-alist 'set-from-style
 c-indent-comments-syntactically-p 'set-from-style
 c-block-comment-prefix 'set-from-style
 c-comment-prefix-regexp 'set-from-style
 c-doc-comment-style 'set-from-style
 c-cleanup-list 'set-from-style
 c-hanging-braces-alist 'set-from-style
 c-hanging-colons-alist 'set-from-style
 c-hanging-semi&comma-criteria 'set-from-style
 c-backslash-column 'set-from-style
 c-backslash-max-column 'set-from-style
 c-special-indent-hook nil
 c-label-minimum-indentation 'set-from-style
 c-offsets-alist '((case-label . 0))
 c-buffer-is-cc-mode nil
 c-tab-always-indent t
 c-syntactic-indentation t
 c-syntactic-indentation-in-macros t
 c-ignore-auto-fill '(string cpp code)
 c-auto-align-backslashes t
 c-backspace-function 'backward-delete-char-untabify
 c-delete-function 'delete-char
 c-electric-pound-behavior nil
 c-default-style '((java-mode . "java") (awk-mode . "awk") (other . "gnu"))
 c-enable-xemacs-performance-kludge-p t
 c-old-style-variable-behavior nil
 defun-prompt-regexp nil
 tab-width 4
 comment-column 32
 parse-sexp-ignore-comments nil
 parse-sexp-lookup-properties nil
 auto-fill-function nil
 comment-multi-line nil
 comment-start-skip nil
 fill-prefix nil
 fill-column 80
 paragraph-start "\f\\|[ 	]*$"
 adaptive-fill-mode t
 adaptive-fill-regexp "[ 	]+\\|[ 	]*\\([0-9]+\\.\\|\\*+\\)[ 	]*"
 )