From unknown Sun Jun 22 07:39:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36802: CC Mode 5.34 (C/*l); Spurious indentation in line after open #include Resent-From: Richard Copley Original-Sender: "Debbugs-submit" Resent-CC: bug-cc-mode@gnu.org Resent-Date: Wed, 24 Jul 2019 20:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36802 X-GNU-PR-Package: cc-mode X-GNU-PR-Keywords: To: 36802@debbugs.gnu.org X-Debbugs-Original-To: submit@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.156399868017760 (code B ref -1); Wed, 24 Jul 2019 20:05:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jul 2019 20:04:40 +0000 Received: from localhost ([127.0.0.1]:38095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqNV9-0004cL-UY for submit@debbugs.gnu.org; Wed, 24 Jul 2019 16:04:40 -0400 Received: from mail-ot1-f51.google.com ([209.85.210.51]:33255) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqNV7-0004c7-46 for submit@debbugs.gnu.org; Wed, 24 Jul 2019 16:04:38 -0400 Received: by mail-ot1-f51.google.com with SMTP id q20so49108459otl.0 for ; Wed, 24 Jul 2019 13:04:37 -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=6EWqxbUoS7OIUB4KB+5uBQxHm8HJPl5lI2znlCUsTAk=; b=hutqN2uXvnuvUjU7ZBGQfN1B6cWhlM9ZyBWLRTj8KASoKMxUDq9gupuXsqMv/70FDf mR+kQMjtJovwnhFJozk6btxbDQpZ5ZET2ELmRd81h05rYuwjFpOorqBh40WCmgE2bafY B71eNClSEKbtEu3T9nAKBGTZcZnO6BxxJXEsw9kL0UhgPXXBYtPUPGf5urqwrkKeBq3X jY1LyUe1p/J1iXA3sZbehd6QeaoimDZr67NytBBE87W3fYTaSnsbxbIsmHMlQo9hoigH WHFWvaEaspKy2m1/0FIVYHtckks1VIMupUu9vIiNwTYDGybrVcl2wT45PyX0uUkMLQ8/ 6lgA== 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=6EWqxbUoS7OIUB4KB+5uBQxHm8HJPl5lI2znlCUsTAk=; b=ODWiBkoWbrQXvYGpNQmu9oJOxg72Y2Evtcm5cFm2bRTAYAuN3dq2AC+HdqCQbXdQIW Ba28IZezMSkzPDOSekm/ZH9++EogZPtwBDzDbao2hDFP515fMhrHF0LstyYM+LEnLLWq L23AEFOiJpd9mvVEpA1R0cXUNfhlvDpcxnztwQscWv1aoEKF2Q02PtekfrmcB+gDmqrI C2HF+X9fvBe+TCNpqbj3ToyURpfXQ6CTHvzSA4xnbVFu3hcRIVJcqGodR3Rf5suTk2BH FiukbF91JSdZdMBP5UjqsgmHaENfhPKuy80R9y/yQ4ANtTYvtafiLSqdNZ/aPw64roWi 3SLQ== X-Gm-Message-State: APjAAAVu0nNOjZFk50J6GsjqEXZ6HGBQrRWm4vrOGk8VEThSv3w6keqL h8elO03cK+IMThO3Qtw/l6c67u5xdH2bWl5ZtkGp8dC0Qzk= X-Google-Smtp-Source: APXvYqyFTLftkV0Tx+1kVbZVCNNuu9orLyD8vqMdwbtJOZyjR0czUEAkRs8iW8mx2ji7OsmqoH9Lyhs6T/n8CXT0hLk= X-Received: by 2002:a9d:77c2:: with SMTP id w2mr770507otl.192.1563998671362; Wed, 24 Jul 2019 13:04:31 -0700 (PDT) MIME-Version: 1.0 From: Richard Copley Date: Wed, 24 Jul 2019 21:04:03 +0100 Message-ID: Content-Type: multipart/alternative; boundary="0000000000003c5d64058e72d1d1" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000003c5d64058e72d1d1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Package: cc-mode (From "emacs -Q".) In an empty C++ buffer, type [#include SPC C-p BACKSPACE C-e RET], or (for a more realistic example), correct "#include " to "#include " like this: ...asio.hpp ;; self-insert-command > ;; c-electric-lt-gt M-b ;; backward-word M-b ;; backward-word ;; backward-kill-word M-> ;; end-of-buffer ;; newline The new line is indented one level (expected zero levels). This corrects itself after doing M-x normal mode. Reproduced below is the story so far, which comes after a discussion of unrelated matters at bug#36397. On Tue, 23 Jul 2019 at 14:10, Alan Mackenzie wrote: On Mon, Jul 22, 2019 at 20:47:22 +0100, Richard Copley wrote: [ .... ] This was an error in the macro cache handling. After the deletion of the >, the cache failed to adjust its upper bound downwards by one. Thus the cache was still representing that the beginning of the new line was inside the macro bounds. The following patch should fix this. Would you please do the usual with it. Just as a matter of interest, how on earth did you manage to stumble across the key sequence (above) which triggers this bug? (The patch, by Alan, is elided by Richard in this email opening the bug report.) Emacs : GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2019-07-23 Package: CC Mode 5.34 (C/*l) Buffer Style: gnu c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties 1-bit) current state: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (setq c-basic-offset 2 c-comment-only-line-offset '(0 . 0) c-indent-comment-alist '((anchored-comment column . 0) (end-block space . 1) (cpp-end-block space . 2)) c-indent-comments-syntactically-p nil c-block-comment-prefix "" c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "#+") (other . "//+\\|\\**")) c-doc-comment-style '((java-mode . javadoc) (pike-mode . autodoc) (c-mode . gtkdoc) (c++-mode . gtkdoc)) c-cleanup-list '(scope-operator) c-hanging-braces-alist '((substatement-open before after) (arglist-cont-nonempty)) c-hanging-colons-alist nil c-hanging-semi&comma-criteria '(c-semi&comma-inside-parenlist) c-backslash-column 48 c-backslash-max-column 72 c-special-indent-hook '(c-gnu-impose-minimum) c-label-minimum-indentation 1 c-offsets-alist '((inexpr-class . +) (inexpr-statement . +) (lambda-intro-cont . +) (inlambda . 0) (template-args-cont c-lineup-template-args +) (incomposition . +) (inmodule . +) (innamespace . +) (inextern-lang . +) (composition-close . 0) (module-close . 0) (namespace-close . 0) (extern-lang-close . 0) (composition-open . 0) (module-open . 0) (namespace-open . 0) (extern-lang-open . 0) (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call + ) (objc-method-args-cont . c-lineup-ObjC-method-args) (objc-method-intro . [0]) (friend . 0) (cpp-define-intro c-lineup-cpp-define +) (cpp-macro-cont . +) (cpp-macro . [0]) (inclass . +) (stream-op . c-lineup-streamop) (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist ) (arglist-cont c-lineup-gcc-asm-reg 0) (comment-intro c-lineup-knr-region-comment c-lineup-comment ) (catch-clause . 0) (else-clause . 0) (do-while-closure . 0) (access-label . -) (case-label . 0) (substatement . +) (statement-case-intro . +) (statement . 0) (brace-entry-open . 0) (brace-list-entry . 0) (brace-list-close . 0) (block-close . 0) (block-open . 0) (inher-cont . c-lineup-multi-inher) (inher-intro . +) (member-init-cont . c-lineup-multi-inher) (member-init-intro . +) (annotation-var-cont . +) (annotation-top-cont . 0) (topmost-intro . 0) (knr-argdecl . 0) (func-decl-cont . +) (inline-close . 0) (class-close . 0) (class-open . 0) (defun-block-intro . +) (defun-close . 0) (defun-open . 0) (c . c-lineup-C-comments) (string . c-lineup-dont-change) (topmost-intro-cont first c-lineup-topmost-intro-cont c-lineup-gnu-DEFUN-intro-cont ) (brace-list-intro first c-lineup-2nd-brace-entry-in-arglist c-lineup-class-decl-init-+ + ) (brace-list-open . +) (inline-open . 0) (arglist-close . c-lineup-arglist) (arglist-intro . c-lineup-arglist-intro-after-paren) (statement-cont . +) (statement-case-open . +) (label . 0) (substatement-label . 0) (substatement-open . +) (knr-argdecl-intro . 5) (statement-block-intro . +) ) c-buffer-is-cc-mode 'c-mode 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 nil c-old-style-variable-behavior nil defun-prompt-regexp nil tab-width 8 comment-column 32 parse-sexp-ignore-comments t parse-sexp-lookup-properties t auto-fill-function nil comment-multi-line t comment-start-skip "\\(//+\\|/\\*+\\)\\s *" fill-prefix nil fill-column 70 paragraph-start "[ ]*\\(//+\\|\\**\\)[ ]*$\\|^\f" adaptive-fill-mode t adaptive-fill-regexp "[ ]*\\(//+\\|\\**\\)[ ]*\\([ ]*\\([-=E2=80=93!|#%;>*= =C2=B7=E2=80=A2=E2=80=A3=E2=81=83=E2=97=A6]+[ ]*\\)*\\)" ) --0000000000003c5d64058e72d1d1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Package: cc-mode

(From "emacs -Q".) In an= empty C++ buffer, type [#include SPC <ab> C-p
BACKSPACE C-e RET],= or (for a more realistic example), correct
"#include <asio/asio= .hpp>" to "#include <asio.hpp>" like this:

= =C2=A0...asio.hpp =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; self-insert-= command
=C2=A0> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ;; c-electric-lt-gt
=C2=A0M-b =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; backward-word
= =C2=A0M-b =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ;; backward-word
=C2=A0<C-backspace> =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ;; backward-kill-word
=C2=A0M-> =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; end-of-buffer
=C2=A0= <return> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; ne= wline

The new line is indented one level (expected zero levels). Thi= s
corrects itself after doing M-x normal mode.

Reproduced below i= s the story so far, which comes after a discussion
of unrelated matters = at bug#36397.

On Tue, 23 Jul 2019 at 14:10, Alan Mackenzie <acm@muc.de> wrote:

=C2=A0 =C2=A0 On = Mon, Jul 22, 2019 at 20:47:22 +0100, Richard Copley wrote:

=C2=A0 = =C2=A0 [ .... ]

=C2=A0 =C2=A0 This was an error in the macro cache h= andling.=C2=A0 After the deletion
=C2=A0 =C2=A0 of the >, the cache f= ailed to adjust its upper bound downwards by
=C2=A0 =C2=A0 one.=C2=A0 Th= us the cache was still representing that the beginning of
=C2=A0 =C2=A0 = the new line was inside the macro bounds.

=C2=A0 =C2=A0 The followin= g patch should fix this.=C2=A0 Would you please do the
=C2=A0 =C2=A0 usu= al with it.

=C2=A0 =C2=A0 Just as a matter of interest, how on earth= did you manage to
=C2=A0 =C2=A0 stumble across the key sequence (above)= which triggers this bug?

(The patch, by Alan, is elided by Richard = in this email opening the bug report.)

Emacs =C2=A0: GNU Emacs 27.0.= 50 (build 1, x86_64-w64-mingw32)
=C2=A0of 2019-07-23
Package: CC Mode= 5.34 (C/*l)
Buffer Style: gnu
c-emacs-features: (pps-extended-state = col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-pr= operties 1-bit)

current state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
(setq
=C2=A0c-basic-offset 2
=C2=A0c-comment-only-line-o= ffset '(0 . 0)
=C2=A0c-indent-comment-alist '((anchored-comment = column . 0) (end-block space . 1)
=C2=A0(cpp-end-block space . 2))=C2=A0c-indent-comments-syntactically-p nil
=C2=A0c-block-comment-pref= ix ""
=C2=A0c-comment-prefix-regexp '((pike-mode . "/= /+!?\\|\\**") (awk-mode . "#+")
=C2=A0 (other . "= ;//+\\|\\**"))
=C2=A0c-doc-comment-style '((java-mode . javadoc= ) (pike-mode . autodoc)
=C2=A0 =C2=A0 =C2=A0 (c-mode . gtkdoc) (c++-m= ode . gtkdoc))
=C2=A0c-cleanup-list '(scope-operator)
=C2=A0c-han= ging-braces-alist '((substatement-open before after)
=C2=A0(argl= ist-cont-nonempty))
=C2=A0c-hanging-colons-alist nil
=C2=A0c-hanging-= semi&comma-criteria '(c-semi&comma-inside-parenlist)
=C2=A0c= -backslash-column 48
=C2=A0c-backslash-max-column 72
=C2=A0c-special-= indent-hook '(c-gnu-impose-minimum)
=C2=A0c-label-minimum-indentatio= n 1
=C2=A0c-offsets-alist '((inexpr-class . +)
=C2=A0 (inexpr-= statement . +)
=C2=A0 (lambda-intro-cont . +)
=C2=A0 (inlambda = . 0)
=C2=A0 (template-args-cont c-lineup-template-args +)
=C2= =A0 (incomposition . +)
=C2=A0 (inmodule . +)
=C2=A0 (innamespa= ce . +)
=C2=A0 (inextern-lang . +)
=C2=A0 (composition-close . = 0)
=C2=A0 (module-close . 0)
=C2=A0 (namespace-close . 0)
= =C2=A0 (extern-lang-close . 0)
=C2=A0 (composition-open . 0)
= =C2=A0 (module-open . 0)
=C2=A0 (namespace-open . 0)
=C2=A0 (ex= tern-lang-open . 0)
=C2=A0 (objc-method-call-cont
=C2=A0 =C2=A0= c-lineup-ObjC-method-call-colons
=C2=A0 =C2=A0c-lineup-ObjC-method-ca= ll
=C2=A0 =C2=A0+
=C2=A0 =C2=A0)
=C2=A0 (objc-method-args= -cont . c-lineup-ObjC-method-args)
=C2=A0 (objc-method-intro . [0]) =C2=A0 (friend . 0)
=C2=A0 (cpp-define-intro c-lineup-cpp-define= +)
=C2=A0 (cpp-macro-cont . +)
=C2=A0 (cpp-macro . [0])
= =C2=A0 (inclass . +)
=C2=A0 (stream-op . c-lineup-streamop)
=C2= =A0 (arglist-cont-nonempty
=C2=A0 =C2=A0c-lineup-gcc-asm-reg
= =C2=A0 =C2=A0c-lineup-arglist
=C2=A0 =C2=A0)
=C2=A0 (arglist-co= nt c-lineup-gcc-asm-reg 0)
=C2=A0 (comment-intro
=C2=A0 =C2=A0c= -lineup-knr-region-comment
=C2=A0 =C2=A0c-lineup-comment
=C2=A0= =C2=A0)
=C2=A0 (catch-clause . 0)
=C2=A0 (else-clause . 0)
= =C2=A0 (do-while-closure . 0)
=C2=A0 (access-label . -)
=C2= =A0 (case-label . 0)
=C2=A0 (substatement . +)
=C2=A0 (statemen= t-case-intro . +)
=C2=A0 (statement . 0)
=C2=A0 (brace-entry-op= en . 0)
=C2=A0 (brace-list-entry . 0)
=C2=A0 (brace-list-close = . 0)
=C2=A0 (block-close . 0)
=C2=A0 (block-open . 0)
=C2= =A0 (inher-cont . c-lineup-multi-inher)
=C2=A0 (inher-intro . +)
= =C2=A0 (member-init-cont . c-lineup-multi-inher)
=C2=A0 (member-ini= t-intro . +)
=C2=A0 (annotation-var-cont . +)
=C2=A0 (annotatio= n-top-cont . 0)
=C2=A0 (topmost-intro . 0)
=C2=A0 (knr-argdecl = . 0)
=C2=A0 (func-decl-cont . +)
=C2=A0 (inline-close . 0)
= =C2=A0 (class-close . 0)
=C2=A0 (class-open . 0)
=C2=A0 (defu= n-block-intro . +)
=C2=A0 (defun-close . 0)
=C2=A0 (defun-open = . 0)
=C2=A0 (c . c-lineup-C-comments)
=C2=A0 (string . c-lineup= -dont-change)
=C2=A0 (topmost-intro-cont
=C2=A0 =C2=A0first
= =C2=A0 =C2=A0c-lineup-topmost-intro-cont
=C2=A0 =C2=A0c-lineup-gnu= -DEFUN-intro-cont
=C2=A0 =C2=A0)
=C2=A0 (brace-list-intro
= =C2=A0 =C2=A0first
=C2=A0 =C2=A0c-lineup-2nd-brace-entry-in-arglist<= br> =C2=A0 =C2=A0c-lineup-class-decl-init-+
=C2=A0 =C2=A0+
= =C2=A0 =C2=A0)
=C2=A0 (brace-list-open . +)
=C2=A0 (inline-open= . 0)
=C2=A0 (arglist-close . c-lineup-arglist)
=C2=A0 (arglist= -intro . c-lineup-arglist-intro-after-paren)
=C2=A0 (statement-cont .= +)
=C2=A0 (statement-case-open . +)
=C2=A0 (label . 0)
= =C2=A0 (substatement-label . 0)
=C2=A0 (substatement-open . +)
= =C2=A0 (knr-argdecl-intro . 5)
=C2=A0 (statement-block-intro . +)
= =C2=A0 )
=C2=A0c-buffer-is-cc-mode 'c-mode
=C2=A0c-tab-always-= indent t
=C2=A0c-syntactic-indentation t
=C2=A0c-syntactic-indentatio= n-in-macros t
=C2=A0c-ignore-auto-fill '(string cpp code)
=C2=A0c= -auto-align-backslashes t
=C2=A0c-backspace-function 'backward-delet= e-char-untabify
=C2=A0c-delete-function 'delete-char
=C2=A0c-elec= tric-pound-behavior nil
=C2=A0c-default-style '((java-mode . "j= ava") (awk-mode . "awk") (other . "gnu"))
=C2= =A0c-enable-xemacs-performance-kludge-p nil
=C2=A0c-old-style-variable-b= ehavior nil
=C2=A0defun-prompt-regexp nil
=C2=A0tab-width 8
=C2=A0= comment-column 32
=C2=A0parse-sexp-ignore-comments t
=C2=A0parse-sexp= -lookup-properties t
=C2=A0auto-fill-function nil
=C2=A0comment-multi= -line t
=C2=A0comment-start-skip "\\(//+\\|/\\*+\\)\\s *"
= =C2=A0fill-prefix nil
=C2=A0fill-column 70
=C2=A0paragraph-start &quo= t;[ ]*\\(//+\\|\\**\\)[ ]*$\\|^\f"
=C2=A0adaptive-fill-mode t
= =C2=A0adaptive-fill-regexp "[ ]*\\(//+\\|\\**\\)[ ]*\\([ ]*\\([-=E2= =80=93!|#%;>*=C2=B7=E2=80=A2=E2=80=A3=E2=81=83=E2=97=A6]+[ ]*\\)*\\)&qu= ot;
=C2=A0)
--0000000000003c5d64058e72d1d1-- From unknown Sun Jun 22 07:39:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36802: CC Mode 5.34 (C/*l); Spurious indentation in line after open #include Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-cc-mode@gnu.org Resent-Date: Thu, 25 Jul 2019 09:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36802 X-GNU-PR-Package: cc-mode X-GNU-PR-Keywords: To: Richard Copley Cc: 36802@debbugs.gnu.org Received: via spool by 36802-submit@debbugs.gnu.org id=B36802.15640466118854 (code B ref 36802); Thu, 25 Jul 2019 09:24:01 +0000 Received: (at 36802) by debbugs.gnu.org; 25 Jul 2019 09:23:31 +0000 Received: from localhost ([127.0.0.1]:38358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqZyE-0002Ij-Of for submit@debbugs.gnu.org; Thu, 25 Jul 2019 05:23:31 -0400 Received: from colin.muc.de ([193.149.48.1]:48579 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hqZyB-0002IZ-HO for 36802@debbugs.gnu.org; Thu, 25 Jul 2019 05:23:28 -0400 Received: (qmail 42733 invoked by uid 3782); 25 Jul 2019 08:30:58 -0000 Received: from acm.muc.de (p4FE15B58.dip0.t-ipconnect.de [79.225.91.88]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 25 Jul 2019 10:30:57 +0200 Received: (qmail 6499 invoked by uid 1000); 25 Jul 2019 09:23:23 -0000 Date: Thu, 25 Jul 2019 09:23:23 +0000 Message-ID: <20190725092323.GA6443@ACM> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello agin, Richard. On Wed, Jul 24, 2019 at 21:04:03 +0100, Richard Copley wrote: > Package: cc-mode > (From "emacs -Q".) In an empty C++ buffer, type [#include SPC C-p > BACKSPACE C-e RET], or (for a more realistic example), correct > "#include " to "#include " like this: > ...asio.hpp ;; self-insert-command > > ;; c-electric-lt-gt > M-b ;; backward-word > M-b ;; backward-word > ;; backward-kill-word > M-> ;; end-of-buffer > ;; newline > The new line is indented one level (expected zero levels). This > corrects itself after doing M-x normal mode. Thanks for the bug report. > Reproduced below is the story so far, which comes after a discussion > of unrelated matters at bug#36397. > On Tue, 23 Jul 2019 at 14:10, Alan Mackenzie wrote: > On Mon, Jul 22, 2019 at 20:47:22 +0100, Richard Copley wrote: > [ .... ] > This was an error in the macro cache handling. After the deletion > of the >, the cache failed to adjust its upper bound downwards by > one. Thus the cache was still representing that the beginning of > the new line was inside the macro bounds. > The following patch should fix this. Would you please do the > usual with it. > Just as a matter of interest, how on earth did you manage to > stumble across the key sequence (above) which triggers this bug? > (The patch, by Alan, is elided by Richard in this email opening the bug > report.) Here is the patch, again. I'm very confident that this fixes the bug properly. Unless I hear otherwise within a day or two, I'll be committing this patch and closing the bug. diff -r 2e20f0567ddf cc-engine.el --- a/cc-engine.el Tue Jul 23 09:45:20 2019 +0000 +++ b/cc-engine.el Tue Jul 23 13:00:17 2019 +0000 @@ -278,6 +278,11 @@ (setcdr c-macro-cache nil) (setq c-macro-cache-start-pos beg c-macro-cache-syntactic nil + c-macro-cache-no-comment nil)) + ((and c-macro-cache-start-pos + (< beg (c-macro-cache-start-pos))) + (setq c-macro-cache-start-pos beg + c-macro-cache-syntactic nil c-macro-cache-no-comment nil)))) (defun c-macro-is-genuine-p () > Emacs : GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) > of 2019-07-23 > Package: CC Mode 5.34 (C/*l) > Buffer Style: gnu > c-emacs-features: (pps-extended-state col-0-paren posix-char-classes > gen-string-delim gen-comment-delim syntax-properties 1-bit) [ .... ] -- Alan Mackenzie (Nuremberg, Germany). From unknown Sun Jun 22 07:39:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36802: CC Mode 5.34 (C/*l); Spurious indentation in line after open #include Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-cc-mode@gnu.org Resent-Date: Fri, 26 Jul 2019 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36802 X-GNU-PR-Package: cc-mode X-GNU-PR-Keywords: To: Richard Copley Cc: 36802@debbugs.gnu.org Received: via spool by 36802-submit@debbugs.gnu.org id=B36802.15641665199388 (code B ref 36802); Fri, 26 Jul 2019 18:42:02 +0000 Received: (at 36802) by debbugs.gnu.org; 26 Jul 2019 18:41:59 +0000 Received: from localhost ([127.0.0.1]:43374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hr5AF-0002RM-5Y for submit@debbugs.gnu.org; Fri, 26 Jul 2019 14:41:59 -0400 Received: from colin.muc.de ([193.149.48.1]:47756 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hr5AC-0002RB-8u for 36802@debbugs.gnu.org; Fri, 26 Jul 2019 14:41:57 -0400 Received: (qmail 38328 invoked by uid 3782); 26 Jul 2019 17:49:26 -0000 Received: from acm.muc.de (p4FE15E05.dip0.t-ipconnect.de [79.225.94.5]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 26 Jul 2019 19:49:25 +0200 Received: (qmail 29309 invoked by uid 1000); 26 Jul 2019 18:41:53 -0000 Date: Fri, 26 Jul 2019 18:41:53 +0000 Message-ID: <20190726184153.GA29232@ACM> References: <20190725092323.GA6443@ACM> <20190725165635.GB7978@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Richard. On Fri, Jul 26, 2019 at 13:13:33 +0100, Richard Copley wrote: > Hi Alan, > [BTW, I didn't really mean to move this discussion to a private email. That > was just clumsiness on my part. I have no objection to any of it being > published. We can join the bug thread if you want.] I've just put it back into the bug thread. > On Thu, 25 Jul 2019 at 17:56, Alan Mackenzie wrote: > > Hello, Richard. > > On Thu, Jul 25, 2019 at 16:35:01 +0100, Richard Copley wrote: > > > On Thu, 25 Jul 2019 at 10:23, Alan Mackenzie wrote: > > [ .... ] > > > > Here is the patch, again. I'm very confident that this fixes the bug > > > > properly. Unless I hear otherwise within a day or two, I'll be > > > > committing this patch and closing the bug. > > > > diff -r 2e20f0567ddf cc-engine.el > > > > --- a/cc-engine.el Tue Jul 23 09:45:20 2019 +0000 > > > > +++ b/cc-engine.el Tue Jul 23 13:00:17 2019 +0000 > > > > @@ -278,6 +278,11 @@ > > > > (setcdr c-macro-cache nil) > > > > (setq c-macro-cache-start-pos beg > > > > c-macro-cache-syntactic nil > > > > + c-macro-cache-no-comment nil)) > > > > + ((and c-macro-cache-start-pos > > > > + (< beg (c-macro-cache-start-pos))) <===================== > > > > + (setq c-macro-cache-start-pos beg > > > > + c-macro-cache-syntactic nil > > > > c-macro-cache-no-comment nil)))) > > > > (defun c-macro-is-genuine-p () > > > > > Emacs : GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) > > > > > of 2019-07-23 > > > > > Package: CC Mode 5.34 (C/*l) > > > > > Buffer Style: gnu > > > > > c-emacs-features: (pps-extended-state col-0-paren posix-char-classes > > > > > gen-string-delim gen-comment-delim syntax-properties 1-bit) > > > > [ .... ] > > > Hi Alan, > > > The byte-compiler complains that c-macro-cache-start-pos is not > > > defined as a function. > > That's wierd. I tested it. I _must_ have tested it. But it's wrong, > > and non-workable. On the marked line, the parentheses around > > c-macro-cache-start-pos should not be there. Maybe I should take a day's > > rest. Sorry about the nuisance. > Thank you, the apology is not at all necessary, but I very much appreciate > it anyway. > It /is/ weird. I didn't notice it at all at first (I saw the compiler > warning during a rebuild, later) but it looks like it should signal an > error. More precisely, it should signal an error at run-time. > Are errors suppressed there, do you think? If not, I suppose I wasn't > testing that code path, though I did intend to. However if a run-time error happens during fontification, the fontification routine is removed from the hook fontification-functions, or sometimes from after-change-functions, leaving fontification not working rather than Emacs remaining hopelessly hung. Maybe this happened. > > Please try this instead: > > diff -r 2e20f0567ddf cc-engine.el > > --- a/cc-engine.el Tue Jul 23 09:45:20 2019 +0000 > > +++ b/cc-engine.el Thu Jul 25 16:51:48 2019 +0000 > > @@ -278,6 +278,11 @@ > > (setcdr c-macro-cache nil) > > (setq c-macro-cache-start-pos beg > > c-macro-cache-syntactic nil > > + c-macro-cache-no-comment nil)) > > + ((and c-macro-cache-start-pos > > + (< beg c-macro-cache-start-pos)) > > + (setq c-macro-cache-start-pos beg > > + c-macro-cache-syntactic nil > > c-macro-cache-no-comment nil)))) > > (defun c-macro-is-genuine-p () > Thanks, I am trying that. It seems no different (?weirdly). I currently > have three patches (of yours) against master: the above for #36802, the > other short patch for #36801, and the longer patch for #36397. Yes: #36397: A M-q in a comment causes 'args-out-of-range'. #36801: In origin[x];, x is being wrongly fontified. #36802: Spurious indentation in line after open #include. That's rather a lot. ;-( Let's see if we can get one or more of these closed over the weekend. Have a good weekend! -- Alan Mackenzie (Nuremberg, Germany). From unknown Sun Jun 22 07:39:11 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Richard Copley Subject: bug#36802: closed (Re: bug#36802: CC Mode 5.34 (C/*l); Spurious indentation in line after open #include) Message-ID: References: <20190802134414.GB11966@ACM> X-Gnu-PR-Message: they-closed 36802 X-Gnu-PR-Package: cc-mode Reply-To: 36802@debbugs.gnu.org Date: Fri, 02 Aug 2019 13:45:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1564753502-25888-1" This is a multi-part message in MIME format... ------------=_1564753502-25888-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #36802: CC Mode 5.34 (C/*l); Spurious indentation in line after open #inclu= de which was filed against the cc-mode package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 36802@debbugs.gnu.org. --=20 36802: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D36802 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1564753502-25888-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 36802-done) by debbugs.gnu.org; 2 Aug 2019 13:44:20 +0000 Received: from localhost ([127.0.0.1]:56105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htXr2-0006iL-Cc for submit@debbugs.gnu.org; Fri, 02 Aug 2019 09:44:20 -0400 Received: from colin.muc.de ([193.149.48.1]:50725 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1htXr0-0006iA-H3 for 36802-done@debbugs.gnu.org; Fri, 02 Aug 2019 09:44:19 -0400 Received: (qmail 26081 invoked by uid 3782); 2 Aug 2019 12:51:44 -0000 Received: from acm.muc.de (p4FE15FF0.dip0.t-ipconnect.de [79.225.95.240]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 02 Aug 2019 14:51:43 +0200 Received: (qmail 13082 invoked by uid 1000); 2 Aug 2019 13:44:14 -0000 Date: Fri, 2 Aug 2019 13:44:14 +0000 To: Richard Copley Subject: Re: bug#36802: CC Mode 5.34 (C/*l); Spurious indentation in line after open #include Message-ID: <20190802134414.GB11966@ACM> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36802-done Cc: 36802-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Richard. On Wed, Jul 24, 2019 at 21:04:03 +0100, Richard Copley wrote: > Package: cc-mode > (From "emacs -Q".) In an empty C++ buffer, type [#include SPC C-p > BACKSPACE C-e RET], or (for a more realistic example), correct > "#include " to "#include " like this: > ...asio.hpp ;; self-insert-command > > ;; c-electric-lt-gt > M-b ;; backward-word > M-b ;; backward-word > ;; backward-kill-word > M-> ;; end-of-buffer > ;; newline > The new line is indented one level (expected zero levels). This > corrects itself after doing M-x normal mode. I've committed the patch we were discussing, and I'm closing this bug. -- Alan Mackenzie (Nuremberg, Germany). ------------=_1564753502-25888-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Jul 2019 20:04:40 +0000 Received: from localhost ([127.0.0.1]:38095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqNV9-0004cL-UY for submit@debbugs.gnu.org; Wed, 24 Jul 2019 16:04:40 -0400 Received: from mail-ot1-f51.google.com ([209.85.210.51]:33255) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqNV7-0004c7-46 for submit@debbugs.gnu.org; Wed, 24 Jul 2019 16:04:38 -0400 Received: by mail-ot1-f51.google.com with SMTP id q20so49108459otl.0 for ; Wed, 24 Jul 2019 13:04:37 -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=6EWqxbUoS7OIUB4KB+5uBQxHm8HJPl5lI2znlCUsTAk=; b=hutqN2uXvnuvUjU7ZBGQfN1B6cWhlM9ZyBWLRTj8KASoKMxUDq9gupuXsqMv/70FDf mR+kQMjtJovwnhFJozk6btxbDQpZ5ZET2ELmRd81h05rYuwjFpOorqBh40WCmgE2bafY B71eNClSEKbtEu3T9nAKBGTZcZnO6BxxJXEsw9kL0UhgPXXBYtPUPGf5urqwrkKeBq3X jY1LyUe1p/J1iXA3sZbehd6QeaoimDZr67NytBBE87W3fYTaSnsbxbIsmHMlQo9hoigH WHFWvaEaspKy2m1/0FIVYHtckks1VIMupUu9vIiNwTYDGybrVcl2wT45PyX0uUkMLQ8/ 6lgA== 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=6EWqxbUoS7OIUB4KB+5uBQxHm8HJPl5lI2znlCUsTAk=; b=ODWiBkoWbrQXvYGpNQmu9oJOxg72Y2Evtcm5cFm2bRTAYAuN3dq2AC+HdqCQbXdQIW Ba28IZezMSkzPDOSekm/ZH9++EogZPtwBDzDbao2hDFP515fMhrHF0LstyYM+LEnLLWq L23AEFOiJpd9mvVEpA1R0cXUNfhlvDpcxnztwQscWv1aoEKF2Q02PtekfrmcB+gDmqrI C2HF+X9fvBe+TCNpqbj3ToyURpfXQ6CTHvzSA4xnbVFu3hcRIVJcqGodR3Rf5suTk2BH FiukbF91JSdZdMBP5UjqsgmHaENfhPKuy80R9y/yQ4ANtTYvtafiLSqdNZ/aPw64roWi 3SLQ== X-Gm-Message-State: APjAAAVu0nNOjZFk50J6GsjqEXZ6HGBQrRWm4vrOGk8VEThSv3w6keqL h8elO03cK+IMThO3Qtw/l6c67u5xdH2bWl5ZtkGp8dC0Qzk= X-Google-Smtp-Source: APXvYqyFTLftkV0Tx+1kVbZVCNNuu9orLyD8vqMdwbtJOZyjR0czUEAkRs8iW8mx2ji7OsmqoH9Lyhs6T/n8CXT0hLk= X-Received: by 2002:a9d:77c2:: with SMTP id w2mr770507otl.192.1563998671362; Wed, 24 Jul 2019 13:04:31 -0700 (PDT) MIME-Version: 1.0 From: Richard Copley Date: Wed, 24 Jul 2019 21:04:03 +0100 Message-ID: Subject: CC Mode 5.34 (C/*l); Spurious indentation in line after open #include To: submit@debbugs.gnu.org Content-Type: multipart/alternative; boundary="0000000000003c5d64058e72d1d1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000003c5d64058e72d1d1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Package: cc-mode (From "emacs -Q".) In an empty C++ buffer, type [#include SPC C-p BACKSPACE C-e RET], or (for a more realistic example), correct "#include " to "#include " like this: ...asio.hpp ;; self-insert-command > ;; c-electric-lt-gt M-b ;; backward-word M-b ;; backward-word ;; backward-kill-word M-> ;; end-of-buffer ;; newline The new line is indented one level (expected zero levels). This corrects itself after doing M-x normal mode. Reproduced below is the story so far, which comes after a discussion of unrelated matters at bug#36397. On Tue, 23 Jul 2019 at 14:10, Alan Mackenzie wrote: On Mon, Jul 22, 2019 at 20:47:22 +0100, Richard Copley wrote: [ .... ] This was an error in the macro cache handling. After the deletion of the >, the cache failed to adjust its upper bound downwards by one. Thus the cache was still representing that the beginning of the new line was inside the macro bounds. The following patch should fix this. Would you please do the usual with it. Just as a matter of interest, how on earth did you manage to stumble across the key sequence (above) which triggers this bug? (The patch, by Alan, is elided by Richard in this email opening the bug report.) Emacs : GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2019-07-23 Package: CC Mode 5.34 (C/*l) Buffer Style: gnu c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties 1-bit) current state: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (setq c-basic-offset 2 c-comment-only-line-offset '(0 . 0) c-indent-comment-alist '((anchored-comment column . 0) (end-block space . 1) (cpp-end-block space . 2)) c-indent-comments-syntactically-p nil c-block-comment-prefix "" c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "#+") (other . "//+\\|\\**")) c-doc-comment-style '((java-mode . javadoc) (pike-mode . autodoc) (c-mode . gtkdoc) (c++-mode . gtkdoc)) c-cleanup-list '(scope-operator) c-hanging-braces-alist '((substatement-open before after) (arglist-cont-nonempty)) c-hanging-colons-alist nil c-hanging-semi&comma-criteria '(c-semi&comma-inside-parenlist) c-backslash-column 48 c-backslash-max-column 72 c-special-indent-hook '(c-gnu-impose-minimum) c-label-minimum-indentation 1 c-offsets-alist '((inexpr-class . +) (inexpr-statement . +) (lambda-intro-cont . +) (inlambda . 0) (template-args-cont c-lineup-template-args +) (incomposition . +) (inmodule . +) (innamespace . +) (inextern-lang . +) (composition-close . 0) (module-close . 0) (namespace-close . 0) (extern-lang-close . 0) (composition-open . 0) (module-open . 0) (namespace-open . 0) (extern-lang-open . 0) (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call + ) (objc-method-args-cont . c-lineup-ObjC-method-args) (objc-method-intro . [0]) (friend . 0) (cpp-define-intro c-lineup-cpp-define +) (cpp-macro-cont . +) (cpp-macro . [0]) (inclass . +) (stream-op . c-lineup-streamop) (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist ) (arglist-cont c-lineup-gcc-asm-reg 0) (comment-intro c-lineup-knr-region-comment c-lineup-comment ) (catch-clause . 0) (else-clause . 0) (do-while-closure . 0) (access-label . -) (case-label . 0) (substatement . +) (statement-case-intro . +) (statement . 0) (brace-entry-open . 0) (brace-list-entry . 0) (brace-list-close . 0) (block-close . 0) (block-open . 0) (inher-cont . c-lineup-multi-inher) (inher-intro . +) (member-init-cont . c-lineup-multi-inher) (member-init-intro . +) (annotation-var-cont . +) (annotation-top-cont . 0) (topmost-intro . 0) (knr-argdecl . 0) (func-decl-cont . +) (inline-close . 0) (class-close . 0) (class-open . 0) (defun-block-intro . +) (defun-close . 0) (defun-open . 0) (c . c-lineup-C-comments) (string . c-lineup-dont-change) (topmost-intro-cont first c-lineup-topmost-intro-cont c-lineup-gnu-DEFUN-intro-cont ) (brace-list-intro first c-lineup-2nd-brace-entry-in-arglist c-lineup-class-decl-init-+ + ) (brace-list-open . +) (inline-open . 0) (arglist-close . c-lineup-arglist) (arglist-intro . c-lineup-arglist-intro-after-paren) (statement-cont . +) (statement-case-open . +) (label . 0) (substatement-label . 0) (substatement-open . +) (knr-argdecl-intro . 5) (statement-block-intro . +) ) c-buffer-is-cc-mode 'c-mode 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 nil c-old-style-variable-behavior nil defun-prompt-regexp nil tab-width 8 comment-column 32 parse-sexp-ignore-comments t parse-sexp-lookup-properties t auto-fill-function nil comment-multi-line t comment-start-skip "\\(//+\\|/\\*+\\)\\s *" fill-prefix nil fill-column 70 paragraph-start "[ ]*\\(//+\\|\\**\\)[ ]*$\\|^\f" adaptive-fill-mode t adaptive-fill-regexp "[ ]*\\(//+\\|\\**\\)[ ]*\\([ ]*\\([-=E2=80=93!|#%;>*= =C2=B7=E2=80=A2=E2=80=A3=E2=81=83=E2=97=A6]+[ ]*\\)*\\)" ) --0000000000003c5d64058e72d1d1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Package: cc-mode

(From "emacs -Q".) In an= empty C++ buffer, type [#include SPC <ab> C-p
BACKSPACE C-e RET],= or (for a more realistic example), correct
"#include <asio/asio= .hpp>" to "#include <asio.hpp>" like this:

= =C2=A0...asio.hpp =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; self-insert-= command
=C2=A0> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ;; c-electric-lt-gt
=C2=A0M-b =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; backward-word
= =C2=A0M-b =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ;; backward-word
=C2=A0<C-backspace> =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ;; backward-kill-word
=C2=A0M-> =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; end-of-buffer
=C2=A0= <return> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; ne= wline

The new line is indented one level (expected zero levels). Thi= s
corrects itself after doing M-x normal mode.

Reproduced below i= s the story so far, which comes after a discussion
of unrelated matters = at bug#36397.

On Tue, 23 Jul 2019 at 14:10, Alan Mackenzie <acm@muc.de> wrote:

=C2=A0 =C2=A0 On = Mon, Jul 22, 2019 at 20:47:22 +0100, Richard Copley wrote:

=C2=A0 = =C2=A0 [ .... ]

=C2=A0 =C2=A0 This was an error in the macro cache h= andling.=C2=A0 After the deletion
=C2=A0 =C2=A0 of the >, the cache f= ailed to adjust its upper bound downwards by
=C2=A0 =C2=A0 one.=C2=A0 Th= us the cache was still representing that the beginning of
=C2=A0 =C2=A0 = the new line was inside the macro bounds.

=C2=A0 =C2=A0 The followin= g patch should fix this.=C2=A0 Would you please do the
=C2=A0 =C2=A0 usu= al with it.

=C2=A0 =C2=A0 Just as a matter of interest, how on earth= did you manage to
=C2=A0 =C2=A0 stumble across the key sequence (above)= which triggers this bug?

(The patch, by Alan, is elided by Richard = in this email opening the bug report.)

Emacs =C2=A0: GNU Emacs 27.0.= 50 (build 1, x86_64-w64-mingw32)
=C2=A0of 2019-07-23
Package: CC Mode= 5.34 (C/*l)
Buffer Style: gnu
c-emacs-features: (pps-extended-state = col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-pr= operties 1-bit)

current state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
(setq
=C2=A0c-basic-offset 2
=C2=A0c-comment-only-line-o= ffset '(0 . 0)
=C2=A0c-indent-comment-alist '((anchored-comment = column . 0) (end-block space . 1)
=C2=A0(cpp-end-block space . 2))=C2=A0c-indent-comments-syntactically-p nil
=C2=A0c-block-comment-pref= ix ""
=C2=A0c-comment-prefix-regexp '((pike-mode . "/= /+!?\\|\\**") (awk-mode . "#+")
=C2=A0 (other . "= ;//+\\|\\**"))
=C2=A0c-doc-comment-style '((java-mode . javadoc= ) (pike-mode . autodoc)
=C2=A0 =C2=A0 =C2=A0 (c-mode . gtkdoc) (c++-m= ode . gtkdoc))
=C2=A0c-cleanup-list '(scope-operator)
=C2=A0c-han= ging-braces-alist '((substatement-open before after)
=C2=A0(argl= ist-cont-nonempty))
=C2=A0c-hanging-colons-alist nil
=C2=A0c-hanging-= semi&comma-criteria '(c-semi&comma-inside-parenlist)
=C2=A0c= -backslash-column 48
=C2=A0c-backslash-max-column 72
=C2=A0c-special-= indent-hook '(c-gnu-impose-minimum)
=C2=A0c-label-minimum-indentatio= n 1
=C2=A0c-offsets-alist '((inexpr-class . +)
=C2=A0 (inexpr-= statement . +)
=C2=A0 (lambda-intro-cont . +)
=C2=A0 (inlambda = . 0)
=C2=A0 (template-args-cont c-lineup-template-args +)
=C2= =A0 (incomposition . +)
=C2=A0 (inmodule . +)
=C2=A0 (innamespa= ce . +)
=C2=A0 (inextern-lang . +)
=C2=A0 (composition-close . = 0)
=C2=A0 (module-close . 0)
=C2=A0 (namespace-close . 0)
= =C2=A0 (extern-lang-close . 0)
=C2=A0 (composition-open . 0)
= =C2=A0 (module-open . 0)
=C2=A0 (namespace-open . 0)
=C2=A0 (ex= tern-lang-open . 0)
=C2=A0 (objc-method-call-cont
=C2=A0 =C2=A0= c-lineup-ObjC-method-call-colons
=C2=A0 =C2=A0c-lineup-ObjC-method-ca= ll
=C2=A0 =C2=A0+
=C2=A0 =C2=A0)
=C2=A0 (objc-method-args= -cont . c-lineup-ObjC-method-args)
=C2=A0 (objc-method-intro . [0]) =C2=A0 (friend . 0)
=C2=A0 (cpp-define-intro c-lineup-cpp-define= +)
=C2=A0 (cpp-macro-cont . +)
=C2=A0 (cpp-macro . [0])
= =C2=A0 (inclass . +)
=C2=A0 (stream-op . c-lineup-streamop)
=C2= =A0 (arglist-cont-nonempty
=C2=A0 =C2=A0c-lineup-gcc-asm-reg
= =C2=A0 =C2=A0c-lineup-arglist
=C2=A0 =C2=A0)
=C2=A0 (arglist-co= nt c-lineup-gcc-asm-reg 0)
=C2=A0 (comment-intro
=C2=A0 =C2=A0c= -lineup-knr-region-comment
=C2=A0 =C2=A0c-lineup-comment
=C2=A0= =C2=A0)
=C2=A0 (catch-clause . 0)
=C2=A0 (else-clause . 0)
= =C2=A0 (do-while-closure . 0)
=C2=A0 (access-label . -)
=C2= =A0 (case-label . 0)
=C2=A0 (substatement . +)
=C2=A0 (statemen= t-case-intro . +)
=C2=A0 (statement . 0)
=C2=A0 (brace-entry-op= en . 0)
=C2=A0 (brace-list-entry . 0)
=C2=A0 (brace-list-close = . 0)
=C2=A0 (block-close . 0)
=C2=A0 (block-open . 0)
=C2= =A0 (inher-cont . c-lineup-multi-inher)
=C2=A0 (inher-intro . +)
= =C2=A0 (member-init-cont . c-lineup-multi-inher)
=C2=A0 (member-ini= t-intro . +)
=C2=A0 (annotation-var-cont . +)
=C2=A0 (annotatio= n-top-cont . 0)
=C2=A0 (topmost-intro . 0)
=C2=A0 (knr-argdecl = . 0)
=C2=A0 (func-decl-cont . +)
=C2=A0 (inline-close . 0)
= =C2=A0 (class-close . 0)
=C2=A0 (class-open . 0)
=C2=A0 (defu= n-block-intro . +)
=C2=A0 (defun-close . 0)
=C2=A0 (defun-open = . 0)
=C2=A0 (c . c-lineup-C-comments)
=C2=A0 (string . c-lineup= -dont-change)
=C2=A0 (topmost-intro-cont
=C2=A0 =C2=A0first
= =C2=A0 =C2=A0c-lineup-topmost-intro-cont
=C2=A0 =C2=A0c-lineup-gnu= -DEFUN-intro-cont
=C2=A0 =C2=A0)
=C2=A0 (brace-list-intro
= =C2=A0 =C2=A0first
=C2=A0 =C2=A0c-lineup-2nd-brace-entry-in-arglist<= br> =C2=A0 =C2=A0c-lineup-class-decl-init-+
=C2=A0 =C2=A0+
= =C2=A0 =C2=A0)
=C2=A0 (brace-list-open . +)
=C2=A0 (inline-open= . 0)
=C2=A0 (arglist-close . c-lineup-arglist)
=C2=A0 (arglist= -intro . c-lineup-arglist-intro-after-paren)
=C2=A0 (statement-cont .= +)
=C2=A0 (statement-case-open . +)
=C2=A0 (label . 0)
= =C2=A0 (substatement-label . 0)
=C2=A0 (substatement-open . +)
= =C2=A0 (knr-argdecl-intro . 5)
=C2=A0 (statement-block-intro . +)
= =C2=A0 )
=C2=A0c-buffer-is-cc-mode 'c-mode
=C2=A0c-tab-always-= indent t
=C2=A0c-syntactic-indentation t
=C2=A0c-syntactic-indentatio= n-in-macros t
=C2=A0c-ignore-auto-fill '(string cpp code)
=C2=A0c= -auto-align-backslashes t
=C2=A0c-backspace-function 'backward-delet= e-char-untabify
=C2=A0c-delete-function 'delete-char
=C2=A0c-elec= tric-pound-behavior nil
=C2=A0c-default-style '((java-mode . "j= ava") (awk-mode . "awk") (other . "gnu"))
=C2= =A0c-enable-xemacs-performance-kludge-p nil
=C2=A0c-old-style-variable-b= ehavior nil
=C2=A0defun-prompt-regexp nil
=C2=A0tab-width 8
=C2=A0= comment-column 32
=C2=A0parse-sexp-ignore-comments t
=C2=A0parse-sexp= -lookup-properties t
=C2=A0auto-fill-function nil
=C2=A0comment-multi= -line t
=C2=A0comment-start-skip "\\(//+\\|/\\*+\\)\\s *"
= =C2=A0fill-prefix nil
=C2=A0fill-column 70
=C2=A0paragraph-start &quo= t;[ ]*\\(//+\\|\\**\\)[ ]*$\\|^\f"
=C2=A0adaptive-fill-mode t
= =C2=A0adaptive-fill-regexp "[ ]*\\(//+\\|\\**\\)[ ]*\\([ ]*\\([-=E2= =80=93!|#%;>*=C2=B7=E2=80=A2=E2=80=A3=E2=81=83=E2=97=A6]+[ ]*\\)*\\)&qu= ot;
=C2=A0)
--0000000000003c5d64058e72d1d1-- ------------=_1564753502-25888-1--