From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Nelson Newsgroups: gmane.emacs.bugs 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 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e9782c05c117f205" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20997"; mail-complaints-to="usenet@ciao.gmane.io" To: 48100@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 29 15:24:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lc6eL-0005LF-Ia for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Apr 2021 15:24:13 +0200 Original-Received: from localhost ([::1]:35470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lc6eK-0007z3-Lt for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Apr 2021 09:24:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lc6eA-0007y9-Gh for bug-gnu-emacs@gnu.org; Thu, 29 Apr 2021 09:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lc6eA-0000YO-8Z for bug-gnu-emacs@gnu.org; Thu, 29 Apr 2021 09:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lc6eA-0006YH-4Y for bug-gnu-emacs@gnu.org; Thu, 29 Apr 2021 09:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Nelson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Apr 2021 13:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48100 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161970263925168 (code B ref -1); Thu, 29 Apr 2021 13:24:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Apr 2021 13:23:59 +0000 Original-Received: from localhost ([127.0.0.1]:55114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lc6e6-0006Xr-Ot for submit@debbugs.gnu.org; Thu, 29 Apr 2021 09:23:59 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lc1fJ-0004Vs-RB for submit@debbugs.gnu.org; Thu, 29 Apr 2021 04:04:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lc1fJ-0002WE-Lb for bug-gnu-emacs@gnu.org; Thu, 29 Apr 2021 04:04:53 -0400 Original-Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:41881) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lc1fG-0001Hf-OD for bug-gnu-emacs@gnu.org; Thu, 29 Apr 2021 04:04:53 -0400 Original-Received: by mail-pf1-x436.google.com with SMTP id v191so3756386pfc.8 for ; Thu, 29 Apr 2021 01:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=D/MqEazEXlJnxMd+QJNXvbC3+W8+jyjm+U9TJEKelvA=; b=DTPOehvhOGrNdW+x/VHfF82VFdifN3aXAjRlqL4KCpp8R53Z/K9d6n675IfeW5lqPI chbF2AHq11lgK8yMClilHYA4ATt/k4oSduAWVwfblpH0SEsX6nsLkSezZlrVK/36hrBP MdhAYyZMgoexbztFVdYKkUbh+b2+GBfuSK9gjaEMX9G9dR774/nz6LKIIjKeenMCCFxE Ps90y5lI+GZ/D5VgDpU6MN/c0C2AbVQSV/p8UZJTA6TEylxKxOshPKUCOlxjNS4nWwGJ v/qrAZ5W650scPkDXn4/rljrvHs1SPgOFN34zHQm7Gosbqngrta5mjip1MmkAOx+B+uZ P40w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=D/MqEazEXlJnxMd+QJNXvbC3+W8+jyjm+U9TJEKelvA=; b=BJUpgEpu+GQ1pBpOR2K1Js2chliQSB8r4aa65DAspqQL3D8M4voBQQzzGjqR+Tz6QJ 8cn1TRIOZ9ujgBpphjzCLuEtUmjwQfoCYOUBw9shCkXcCmv3yKjreCizHf2orWQpRfOt hx2yAfOYO1RlFdKyD7WxzdUjA8+viv81Ef6te/DPHfQ2uD0V5EGflHwqWJuVLY+leXO3 9/dCdtGvR76/jUEe/fgX2N6HJ826MT0VnTfRL07+fIHK7d/OIX0Jlpdd8AuzpgyX+lvl 661vPcUrw6pud9LwOle3/GcLsZPFZ4eDnfFHPKts9cbCEJcQT1CRcflyT1Cqne9LW9xB MiTg== X-Gm-Message-State: AOAM532Gxi7WD86yEuYFdq7RIQfiBa+12cBNgdVEQf7X99KjSTYttWZy OBxQpCijvG8xxpYsHGj6nhqFUYjKBFc6opSwHIfNJkV21JQ= X-Google-Smtp-Source: ABdhPJxBc4lDRJgCulHFSVJQGxWFnr/Vkpo7a9jY/u1r+qYKTte6SgWnpLMmq0Yj3SilDk6E4+ursV3Aiz0peuFlEKA= X-Received: by 2002:a65:4d49:: with SMTP id j9mr30333598pgt.113.1619683487347; Thu, 29 Apr 2021 01:04:47 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=ultrono@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 29 Apr 2021 09:23:58 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205179 Archived-At: --000000000000e9782c05c117f205 Content-Type: text/plain; charset="UTF-8" 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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include 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)) --000000000000e9782c05c117f205 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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.=C2=A0 Moreover, the offending function
&qu= ot;c-guess-basic-syntax" seems to break edebug instrumentation.
<= div>
In more detail:

Start from emacs -Q.=C2=A0 Insert= sufficiently many lines of C++ code in a
temporary buffer.=C2=A0 A slig= htly contrived example:

#include <cstdio>
#include <cstd= lib>
#include <cstring>
#include <climits>
#include= <cfloat>
#include <vector>
#include <cmath>
#in= clude <set>
#include <list>
#include <map>
#incl= ude <stack>
#include <queue>
#include <iostream>#include <sstream>
#include <fstream>
#include <algor= ithm>
#include <numeric>
#include <functional>
#inc= lude <cstdio>
#include <cstdlib>
#include <cstring>=
#include <climits>
#include <cfloat>
#include <vec= tor>
#include <cmath>
#include <set>
#include <l= ist>
#include <map>
#include <stack>

Copy these= lines to the kill ring.=C2=A0 Create a new file "test.cpp", and<= br>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 suc= h 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
offend= ing lines, but the buffer remains in a broken state.=C2=A0 For
instance,= attempting to insert a couple newlines followed by
=C2=A0 int ma= in(
gives the following error:

Debugger entered--Lisp error: (wro= ng-type-argument number-or-marker-p nil)
=C2=A0 c-guess-basic-syntax()=C2=A0 c-indent-line()
=C2=A0 indent-according-to-mode()
=C2=A0 c-e= lectric-paren(nil)
=C2=A0 funcall-interactively(c-electric-paren nil)=C2=A0 command-execute(c-electric-paren)

Incidentally, "C-u C-= M-x" applied to c-guess-basic-syntax gives a long and complicated back= trace that starts with:

Debugger entered--Lisp error: (invalid-read-= syntax "Expected" "lambda")
=C2=A0 edebug-syntax-err= or("Expected" "lambda")

---


In GNU Em= acs 28.0.50 (build 2, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version = 10.15.7 (Build 19H524))
=C2=A0of 2021-04-26 built on Pauls-MBP-2
Repo= sitory revision: 9d34fd8b33c55768190d41239931120e3fc9717f
Repository bra= nch: master
Windowing system distributor 'Apple', version 10.3.1= 894
System Description: =C2=A0Mac OS X 10.15.7

Configured using:<= br>=C2=A0'configure --with-native-compilation'

Configured fe= atures:
ACL DBUS GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIF= Y KQUEUE
NS PDUMPER PNG THREADS TIFF TOOLKIT_SCROLL_BARS XIM ZLIB
Important settings:
=C2=A0 value of $LC_CTYPE: UTF-8
=C2=A0 value of= $LANG: en_CH.UTF-8
=C2=A0 locale-coding-system: utf-8-unix

Major= mode: C++//l

Minor modes in effect:
=C2=A0 tooltip-mode: t
= =C2=A0 global-eldoc-mode: t
=C2=A0 electric-indent-mode: t
=C2=A0 mou= se-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
= =C2=A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode: t
=C2= =A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-composi= tion-mode: t
=C2=A0 auto-encryption-mode: t
=C2=A0 auto-compression-m= ode: t
=C2=A0 line-number-mode: t
=C2=A0 transient-mark-mode: t
= =C2=A0 abbrev-mode: t

Load-path shadows:
None found.

Featu= res:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loadde= fs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmai= l-loaddefs auth-source eieio eieio-core eieio-loaddefs
password-cache js= on 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 byt= e-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 el= doc 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 eli= sp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow i= search 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 eu= cjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indi= an
cyrillic chinese composite charscript charprop case-table epa-hookjka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
lo= addefs faces cus-face macroexp files window text-properties overlay
sha1= md5 base64 format env code-pages mule custom widget
hashtable-print-rea= dable backquote threads dbusbind kqueue cocoa ns
lcms2 multi-tty make-ne= twork-process nativecomp emacs)

Memory information:
((conses 16 1= 26796 8572)
=C2=A0(symbols 48 11546 0)
=C2=A0(strings 32 31421 1656)<= br>=C2=A0(string-bytes 1 1165707)
=C2=A0(vectors 16 18464)
=C2=A0(vec= tor-slots 8 333103 10770)
=C2=A0(floats 8 30 33)
=C2=A0(intervals 56 = 540 0)
=C2=A0(buffers 992 14))
--000000000000e9782c05c117f205--