GNU bug report logs -
#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`
Previous Next
To reply to this bug, email your comments to 37547 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-cc-mode <at> gnu.org
:
bug#37547
; Package
cc-mode
.
(Sun, 29 Sep 2019 05:26:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Sun, Wei" <waysun <at> amazon.com>
:
New bug report received and forwarded. Copy sent to
bug-cc-mode <at> gnu.org
.
(Sun, 29 Sep 2019 05:26:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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]+\\.\\|\\*+\\)[ ]*"
)
Information forwarded
to
bug-cc-mode <at> gnu.org
:
bug#37547
; Package
cc-mode
.
(Sun, 29 Sep 2019 16:15:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 37547 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello, Wei.
Thank you for taking the trouble to report this bug, and thanks even
more for stripping it down to a bare minimum amount of text.
On Sun, Sep 29, 2019 at 02:36:47 +0000, Sun, Wei via CC-Mode-help wrote:
> 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)
Yes. The cause of this problem is the use of the regular expression
"\\<\\>" in CC Mode, which was meant "not to match anything". It turns
out that if an Asian character is directly followed by a European
character without spaces between them, this position can be at both the
start of a word and the end of a word. This is what has happened here.
This bug was actually fixed in the Emacs master branch last year, but
was too late to make it into Emacs 26. The fix was to use an actual
"will never match" regular expression, namely "a\\`".
> what's more, if you are visiting a large c++ file, after this error
> occurs, then everything will become very slow.
This happens because the error with the regexp causes CC Mode's "before
change function" to get removed from before-change-hook. When CC Mode
detects this, as a precaution against file corruption, it assumes every
change is over the entire buffer. This prevents any loss of text, but
runs very slowly.
[ Dump of CC Mode's configuration appreciated, but snipped.]
As a workaround to the bug, please apply the attached patch and byte
compile CC Mode. (CC Mode is the ?14 files
emacs/lisp/progmodes/cc-*.el). If you want any help in applying this
patch or byte compiling the result, feel free to send me private email.
Thanks again for this bug report!
--
Alan Mackenzie (Nuremberg, Germany).
[diff.20190929.diff (text/plain, attachment)]
This bug report was last modified 5 years and 260 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.