From: Paul Nelson <ultrono@gmail.com>
To: 48100@debbugs.gnu.org
Subject: bug#48100: 28.0.50; inserting too many lines into a fresh cpp file breaks the buffer
Date: Thu, 29 Apr 2021 10:04:36 +0200 [thread overview]
Message-ID: <CAOA-32PSKEQC8mzO64KGWu-Og+AF6zWTtCgO-gjes5CnvNHaiQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4966 bytes --]
Inserting a sufficiently large chunk of text into a fresh cpp file
breaks syntax highlighting and causes the buffer to enter a
semi-permanent broken state. Moreover, the offending function
"c-guess-basic-syntax" seems to break edebug instrumentation.
In more detail:
Start from emacs -Q. Insert sufficiently many lines of C++ code in a
temporary buffer. A slightly contrived example:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <vector>
#include <cmath>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <queue>
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <vector>
#include <cmath>
#include <set>
#include <list>
#include <map>
#include <stack>
Copy these lines to the kill ring. Create a new file "test.cpp", and
paste what was copied.
The first error is that syntax highlighting stops after a certain
number of lines (in the above example, just before the final line).
The same problem arises if such lines are inserted via abbrev-mode.
This is the intended use case.
No problem if such lines are copy/pasted in small enough chunks.
The problem *appears* to go away if one cuts and then pastes the
offending lines, but the buffer remains in a broken state. For
instance, attempting to insert a couple newlines followed by
int main(
gives the following error:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
c-guess-basic-syntax()
c-indent-line()
indent-according-to-mode()
c-electric-paren(nil)
funcall-interactively(c-electric-paren nil)
command-execute(c-electric-paren)
Incidentally, "C-u C-M-x" applied to c-guess-basic-syntax gives a long and
complicated backtrace that starts with:
Debugger entered--Lisp error: (invalid-read-syntax "Expected" "lambda")
edebug-syntax-error("Expected" "lambda")
---
In GNU Emacs 28.0.50 (build 2, x86_64-apple-darwin19.6.0, NS appkit-1894.60
Version 10.15.7 (Build 19H524))
of 2021-04-26 built on Pauls-MBP-2
Repository revision: 9d34fd8b33c55768190d41239931120e3fc9717f
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1894
System Description: Mac OS X 10.15.7
Configured using:
'configure --with-native-compilation'
Configured features:
ACL DBUS GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE
NS PDUMPER PNG THREADS TIFF TOOLKIT_SCROLL_BARS XIM ZLIB
Important settings:
value of $LC_CTYPE: UTF-8
value of $LANG: en_CH.UTF-8
locale-coding-system: utf-8-unix
Major mode: C++//l
Minor modes in effect:
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
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs
password-cache json map text-property-search time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils novice
comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra help-mode seq
byte-opt gv bytecomp byte-compile cconv cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
cl-loaddefs cl-lib iso-transl tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type 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 elisp-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 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 dbusbind kqueue cocoa ns
lcms2 multi-tty make-network-process nativecomp emacs)
Memory information:
((conses 16 126796 8572)
(symbols 48 11546 0)
(strings 32 31421 1656)
(string-bytes 1 1165707)
(vectors 16 18464)
(vector-slots 8 333103 10770)
(floats 8 30 33)
(intervals 56 540 0)
(buffers 992 14))
[-- Attachment #2: Type: text/html, Size: 5795 bytes --]
next reply other threads:[~2021-04-29 8:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 8:04 Paul Nelson [this message]
2021-05-02 7:58 ` bug#48100: 28.0.50; inserting too many lines into a fresh cpp file breaks the buffer Lars Ingebrigtsen
2021-05-02 12:24 ` Alan Mackenzie
2021-05-02 13:33 ` Basil L. Contovounesios
2021-05-02 15:01 ` Alan Mackenzie
2021-05-05 3:01 ` Paul Nelson
2021-05-05 9:26 ` Lars Ingebrigtsen
2021-05-05 10:18 ` Alan Mackenzie
2021-05-06 10:26 ` Paul Nelson
2021-05-09 9:33 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOA-32PSKEQC8mzO64KGWu-Og+AF6zWTtCgO-gjes5CnvNHaiQ@mail.gmail.com \
--to=ultrono@gmail.com \
--cc=48100@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).