From unknown Sat Jun 21 12:12:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45375: cc-mode indentation sometimes doesn't work Resent-From: Herman, =?UTF-8?Q?G=C3=A9za?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Dec 2020 23:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45375 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 45375@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160867814928603 (code B ref -1); Tue, 22 Dec 2020 23:03:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Dec 2020 23:02:29 +0000 Received: from localhost ([127.0.0.1]:51159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krqfk-0007RG-P5 for submit@debbugs.gnu.org; Tue, 22 Dec 2020 18:02:28 -0500 Received: from lists.gnu.org ([209.51.188.17]:50454) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krqfh-0007R6-Gh for submit@debbugs.gnu.org; Tue, 22 Dec 2020 18:02:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krqff-0007p1-Qz for bug-gnu-emacs@gnu.org; Tue, 22 Dec 2020 18:02:25 -0500 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:38399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1krqfd-0001jY-5J for bug-gnu-emacs@gnu.org; Tue, 22 Dec 2020 18:02:23 -0500 Received: by mail-ej1-x629.google.com with SMTP id 6so20371705ejz.5 for ; Tue, 22 Dec 2020 15:02:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=tqCB6gDxSjfi8xbeRvIWcQtv/dT7Por7J8BwUet9m58=; b=CIrIuxO/DtQmFDXga8PO2V8f6tg2nPVt/NWi6S7hLwHRbE6gM/ghRxd1O7kOpwTvzX fn9k00BVJy49wLFtzgfjKZFugklCQmsYi28CXoVqE6l9/jsM4ydqokDJ8Q8WXjlXjirt +mw2zplktgqNObPppNZYtIDs2bnvFhHZtXDA2cpkS7NnJK3c52nrvmraJS0FGokkRtAg HBQywK9xaMQCMglbgHGOKnMrQDR4Y4U6+CBB8Q2pH8LYROBdi7JcfxXExxxBIcHL9WL2 xGMwFgh66V9byCbt9KbJ7tgPRK/N9WgQt1SmR2+MlgT7wTLV0Ho4vlnnUn+jggEPKBNj jKuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=tqCB6gDxSjfi8xbeRvIWcQtv/dT7Por7J8BwUet9m58=; b=b1d2YxXaV/Tn9M6VrhC3ey+wQ1cPYtManLMcIOeG4RPjPocNI9MsOt5n+amE7fhWeZ E8aunORBtK3UVK40MUF+P35blCO0sQfGrzwirOr0rWfrGW8wqc43DNgaM2RUmC8ZIzSf ALZewr8UpGvObQ2c5iWQ3rIMGL+h1dzVhO4JEkOe/XuhiCDyV8TCn3eWVF17VarGp2NP IkAytp34gZjKswQjXumpBBuffPluS75doGdmlGDG2d2GWikXNATHciRyztprE1ris4Hk FcI5mIwVVuXblZNngy/+ejlZJ9KMN8rCWV9Bo3r1WYLEWxtYk75ZZqIjggwHdJj1Hwlc oB2g== X-Gm-Message-State: AOAM531w8UcRBNbdeurgQlasU1mlHV3ygQgpruiFNBKSAYqQ9Tw7v8mw jJckkq7doeF+YIlQ0sVft4s= X-Google-Smtp-Source: ABdhPJz9I17iO4X2YHV+wppFukDjZAXDFXwfYQESZ/9oKxPzHkPVP/WnhvoLTk6B5fzSaQJqxNXkuQ== X-Received: by 2002:a17:907:1009:: with SMTP id ox9mr21765276ejb.37.1608678139029; Tue, 22 Dec 2020 15:02:19 -0800 (PST) Received: from [192.168.8.4] (netacc-gpn-34-122-8.pool.telenor.hu. [37.234.122.8]) by smtp.gmail.com with ESMTPSA id v18sm29915324edx.30.2020.12.22.15.02.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Dec 2020 15:02:18 -0800 (PST) From: Herman, =?UTF-8?Q?G=C3=A9za?= Message-ID: Date: Wed, 23 Dec 2020 00:02:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: sv-FI Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=geza.herman@gmail.com; helo=mail-ej1-x629.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, 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-Spam-Score: -1.3 (-) 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: -2.3 (--) On current master (6af31fd71ff1a403c199c479577bcc145a547db1) indentation of C/C++ files sometimes doesn't work. I've bisected it: commit "9022df7027 Optimise c-parse-state for large buffers with few (if any) braces." introduced this behavior. This is how to reproduce: check out 9022df70270243f211c54ccd66800320148b8434, and execute "emacs -Q xdisp.c". Jump to line 2989 with M-g M-g 2989, move the cursor to the end of line of "Lisp_Object retval;", and press enter. The cursor will be moved to the correct place (correctly indented, cursor will be placed below the 'L' character of the previous line). Then push enter at end of line of "va_list ap;". For me, cursor will jump to the beginning of the line, it won't be indented. If I keep pressing enters, the next failure will be at "va_end (ap);". I'm not sure whether this exact steps reproduces for everyone, but it happened me 5 of 5 trials. If I don't press enter at the first line ("Lisp_Object retval;"), the problem doesn't happen for any of this function lines. But it will happen for somewhere else, if I keep trying (move around the file, press enter at random places: if will fail sooner or later). For my configuration (without -Q), this problem happens quite frequently during editing C++ code. From unknown Sat Jun 21 12:12:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45375: cc-mode indentation sometimes doesn't work Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Feb 2021 21:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45375 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?G=C3=A9za?= Herman Cc: Alan Mackenzie , 45375@debbugs.gnu.org Received: via spool by 45375-submit@debbugs.gnu.org id=B45375.161316468822242 (code B ref 45375); Fri, 12 Feb 2021 21:19:01 +0000 Received: (at 45375) by debbugs.gnu.org; 12 Feb 2021 21:18:08 +0000 Received: from localhost ([127.0.0.1]:33124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAfpI-0005mf-2M for submit@debbugs.gnu.org; Fri, 12 Feb 2021 16:18:08 -0500 Received: from mail-wr1-f52.google.com ([209.85.221.52]:36967) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAfpF-0005mA-9K for 45375@debbugs.gnu.org; Fri, 12 Feb 2021 16:18:07 -0500 Received: by mail-wr1-f52.google.com with SMTP id v15so883272wrx.4 for <45375@debbugs.gnu.org>; Fri, 12 Feb 2021 13:18:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=NsUDs+Y5dswlPrhftqqV4b3OVU7VQd097tiUS7z2kBM=; b=O4TqB+IPqEtbsY4P5Tz5rk0b7iZP643hJPcpPaUk3ws4l05F2Ff0DIO2md0ov2+omj Mgn2dGcZCW8/rbBlxwYTSE3FN5rqumQC8x8+jLLFzVf7MBbj4vxvgau7nOi1qE2yA3A3 ePIbi8hM303Yah5MN3u6v3VOGxuCL61XeACGZPzv0/+YMWfWqXXpP704UvW9WUdxftRk HybCCCzHnO53dCMKjwIL54bqVmp+gC3zfqRAhZbqNYUtCVH1Z7Sxa0+oFIc4O2XQpTPB EdFw4b8SnOt74FZAIIGPLBLsZB5k0dRuQL8Cj6ZKdpuy/r1VI5jbGQXVJivISRSfcDqg qNlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=NsUDs+Y5dswlPrhftqqV4b3OVU7VQd097tiUS7z2kBM=; b=bJ+JhLYutUarC9ZO70QFEtpTm0YloqxKoippgZzQ3mLCcvo6nmrjnxKXcoZYb9E+Zw 8K+NEf6ObhEAQNzYqZZazr8GTzlQLB70p0/+qOeMfA1f1SMwdS9EujdaNUSYjYTC3EU5 WVf7H+cf2sdBsYcRHs+chxfaSpV0gMRgYGCbhKh5Xi9VQa9sXn1M5L3Uy70SqHq9QPgg vlDVMlEw+ajc6ZXwnJ0SdCW997p9K36ehXlT6xS12SmJR6WyGo7BEdu0exTwJpL3S4GM /rjIEJIHLTQk3UcvVdXOmDWUl69Apkh6aEc7QSHyJ3W351pnrII5e6U1oXpUdin4EcKt AZnw== X-Gm-Message-State: AOAM531gIcGUA3o+abGSCkFmtjdfqLQAW8CYn++CakVatf7L5ombuQKv Xg2yLnocttdQYnlABFzMwk+yuA== X-Google-Smtp-Source: ABdhPJx1/Wj0XPBmkruzPuKrl4XVIxTp0Kl2/5gwTyD5bbvb9KdwDajq3hB1TKsl7b1a8q2iwMCnZw== X-Received: by 2002:adf:e988:: with SMTP id h8mr4179956wrm.2.1613164679375; Fri, 12 Feb 2021 13:17:59 -0800 (PST) Received: from localhost ([2a02:8084:20e2:c380:f410:82e8:3a21:eedf]) by smtp.gmail.com with ESMTPSA id i10sm14687435wrp.0.2021.02.12.13.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 13:17:58 -0800 (PST) From: "Basil L. Contovounesios" References: Date: Fri, 12 Feb 2021 21:17:56 +0000 In-Reply-To: ("Herman@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?="'s message of "Wed, 23 Dec 2020 00:02:17 +0100") Message-ID: <87r1ll9e9n.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 (-) reassign 45375 emacs,cc-mode quit [CCed CC Mode maintainer.] Herman@debbugs.gnu.org, G=C3=A9za writes: > On current master (6af31fd71ff1a403c199c479577bcc145a547db1) indentation = of > C/C++ files sometimes doesn't work. I've bisected it: commit "9022df7027 > Optimise c-parse-state for large buffers with few (if any) braces." intro= duced > this behavior. > > This is how to reproduce: check out 9022df70270243f211c54ccd66800320148b8= 434, > and execute "emacs -Q xdisp.c". Jump to line 2989 with M-g M-g 2989, move= the > cursor to the end of line of "Lisp_Object retval;", and press enter. The = cursor > will be moved to the correct place (correctly indented, cursor will be pl= aced > below the 'L' character of the previous line). Then push enter at end of = line of > "va_list ap;". For me, cursor will jump to the beginning of the line, it = won't > be indented. If I keep pressing enters, the next failure will be at "va_e= nd > (ap);". I'm not sure whether this exact steps reproduces for everyone, bu= t it > happened me 5 of 5 trials. If I don't press enter at the first line > ("Lisp_Object retval;"), the problem doesn't happen for any of this funct= ion > lines. But it will happen for somewhere else, if I keep trying (move arou= nd the > file, press enter at random places: if will fail sooner or later). > > For my configuration (without -Q), this problem happens quite frequently = during > editing C++ code. I tried following your recipe (the lines in xdisp.c have since moved around a bit), but was unable to reproduce the issue. Can you still reproduce it on your end? Thanks, --=20 Basil From unknown Sat Jun 21 12:12:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45375: cc-mode indentation sometimes doesn't work Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 13 Feb 2021 14:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45375 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: "Basil L. Contovounesios" Cc: acm@muc.de, 46400@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= Herman , 45375@debbugs.gnu.org Received: via spool by 45375-submit@debbugs.gnu.org id=B45375.161322717716267 (code B ref 45375); Sat, 13 Feb 2021 14:40:01 +0000 Received: (at 45375) by debbugs.gnu.org; 13 Feb 2021 14:39:37 +0000 Received: from localhost ([127.0.0.1]:33908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAw5A-0004EI-Ut for submit@debbugs.gnu.org; Sat, 13 Feb 2021 09:39:37 -0500 Received: from colin.muc.de ([193.149.48.1]:16118 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lAw58-0004Dz-UB for 45375@debbugs.gnu.org; Sat, 13 Feb 2021 09:39:35 -0500 Received: (qmail 68116 invoked by uid 3782); 13 Feb 2021 14:39:28 -0000 Received: from acm.muc.de (p2e5d52cc.dip0.t-ipconnect.de [46.93.82.204]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 13 Feb 2021 15:39:27 +0100 Received: (qmail 1069 invoked by uid 1000); 13 Feb 2021 14:39:27 -0000 Date: Sat, 13 Feb 2021 14:39:27 +0000 Message-ID: References: <87r1ll9e9n.fsf@tcd.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87r1ll9e9n.fsf@tcd.ie> X-Submission-Agent: TMDA/1.3.x (Ph3nix) 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, Basil, Géza and Konstantin. Sorry I missed this bug report in December, and thanks, Basil, for drawing it to my attention. On Fri, Feb 12, 2021 at 21:17:56 +0000, Basil L. Contovounesios wrote: > reassign 45375 emacs,cc-mode > quit > [CCed CC Mode maintainer.] > Herman@debbugs.gnu.org, Géza writes: > > On current master (6af31fd71ff1a403c199c479577bcc145a547db1) indentation of > > C/C++ files sometimes doesn't work. I've bisected it: commit "9022df7027 > > Optimise c-parse-state for large buffers with few (if any) braces." introduced > > this behavior. > > This is how to reproduce: check out 9022df70270243f211c54ccd66800320148b8434, > > and execute "emacs -Q xdisp.c". Jump to line 2989 with M-g M-g 2989, move the > > cursor to the end of line of "Lisp_Object retval;", and press enter. The cursor > > will be moved to the correct place (correctly indented, cursor will be placed > > below the 'L' character of the previous line). Then push enter at end of line of > > "va_list ap;". For me, cursor will jump to the beginning of the line, it won't > > be indented. If I keep pressing enters, the next failure will be at "va_end > > (ap);". I'm not sure whether this exact steps reproduces for everyone, but it > > happened me 5 of 5 trials. If I don't press enter at the first line > > ("Lisp_Object retval;"), the problem doesn't happen for any of this function > > lines. But it will happen for somewhere else, if I keep trying (move around the > > file, press enter at random places: if will fail sooner or later). > > For my configuration (without -Q), this problem happens quite frequently during > > editing C++ code. > I tried following your recipe (the lines in xdisp.c have since moved > around a bit), but was unable to reproduce the issue. > Can you still reproduce it on your end? I can reproduce it easily on the indicated commit, and I have found where the problem is. It's in the handling of the c-state-cache (the cache which tracks the positions of certain braces/brackets/parentheses). Fixing it could be quite tricky, particularly given the need to retain optimisation for the case that the above commit "fixed". I am fairly, but not absolutely, sure that this is the same bug as 46400, but the bug scenario here is easier to reproduce than the other one, so I will concentrate on this bug first. Maybe we can join the bug reports later. > Thanks, > -- > Basil -- Alan Mackenzie (Nuremberg, Germany). From unknown Sat Jun 21 12:12:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45375: cc-mode indentation sometimes doesn't work Resent-From: Herman, =?UTF-8?Q?G=C3=A9za?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 13 Feb 2021 18:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45375 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Alan Mackenzie , "Basil L. Contovounesios" Cc: 46400@debbugs.gnu.org, 45375@debbugs.gnu.org Received: via spool by 45375-submit@debbugs.gnu.org id=B45375.16132418247730 (code B ref 45375); Sat, 13 Feb 2021 18:44:01 +0000 Received: (at 45375) by debbugs.gnu.org; 13 Feb 2021 18:43:44 +0000 Received: from localhost ([127.0.0.1]:35058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAztQ-00020W-Dp for submit@debbugs.gnu.org; Sat, 13 Feb 2021 13:43:44 -0500 Received: from mail-ed1-f48.google.com ([209.85.208.48]:43421) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAztL-00020B-8T; Sat, 13 Feb 2021 13:43:43 -0500 Received: by mail-ed1-f48.google.com with SMTP id v7so3639593eds.10; Sat, 13 Feb 2021 10:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=uZTHw7995ua0i0Mc9BXRtOeb/9Ye6arZf4xFkpSEcsk=; b=Rb0WkWIJKDTf64XxPJ7/fCyI4++vNpHiM+Jf91SapzTsJ00LydXp/zdqebGw2YJq8O 1sfSMfpm0Yjh3KlOqn3qlyiVxjdd4WtqK/bZTeqU2n1BXLb5zYbMKmSlzP7nW6Xv9Zyt aF6GDJQhjGDZT0jYO/7mrN+ar2a46UtQ0HM75i1pOJw5rSp82zBE927o1RyMRqSHRYoi C8AqiAhNzqbWf+/SxvvFVABTY2hRA6m3w3EUX/m+8MsCBpH69Fd9nEvtGIm1VxJkgVjK cPywYOx17R4YW4Gf2FapUaZv7VL0lzxv3O8PNbM8eeEVyiGxcxwv4w9/oMFEt8eEh+qp nH5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=uZTHw7995ua0i0Mc9BXRtOeb/9Ye6arZf4xFkpSEcsk=; b=Bf7+4tup4jb79UyHLl9FXiiF6szlLofFITFjUcbuU3mIUwhqQ/iFtb6VbAtHDx8l8t KcyqPhCT5knmAXqpA/+bfrMg8yCUUT5lNkLf8Sd80KAQR1uexos8YqYElDN43QeAoBr9 9U1OJL13UPyYTOBQX8gAGuA5KGMQMhUZojKtiGcmnt2DZShXtLChk4QlBcH9to3uBEjp dxuPl8MeJohKQG0jEveHHO8FaGE6L4sG5nJ4nGoDlbZWd28o9nMJvHwCwvAI94Pv2mo6 DyjkWN5Tw0dMQ+DC15KD6zOwquummxslHYCGRxDro5OUxCLBpm8O4DlBvdtZGopTB731 VaAQ== X-Gm-Message-State: AOAM533mg8bJXOul/O9gmH0juLuX6P2Sb9gS++U53iHaZXh7ixvr7/Hi 4h7p/4Hj4KLti7u/usqY484= X-Google-Smtp-Source: ABdhPJwhqjX2REGao4J4XHmjO1F7+hMyRQP5t4oM7+s5bQ8PmQvurPBW3aXXSRajQeYj62JNxd4flA== X-Received: by 2002:aa7:d5c9:: with SMTP id d9mr8823719eds.245.1613241813416; Sat, 13 Feb 2021 10:43:33 -0800 (PST) Received: from [192.168.8.4] (netacc-gpn-4-21-56.pool.telenor.hu. [84.224.21.56]) by smtp.gmail.com with ESMTPSA id qk14sm8084701ejb.13.2021.02.13.10.43.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Feb 2021 10:43:33 -0800 (PST) References: <87r1ll9e9n.fsf@tcd.ie> From: Herman, =?UTF-8?Q?G=C3=A9za?= Message-ID: Date: Sat, 13 Feb 2021 19:43:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: sv-FI 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 (-) Hi all, >> Can you still reproduce it on your end? > I'm using a ~3-week-old native-comp branch, this bug (#45375) doesn't happen anymore for me. Note that the bisect gave a different commit for #46400, so maybe the issues are different, even though the symptoms are very similar (same?). Thank you for looking at this! Geza From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 14 05:38:41 2021 Received: (at control) by debbugs.gnu.org; 14 Feb 2021 10:38:41 +0000 Received: from localhost ([127.0.0.1]:35473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBEnY-00088e-Sd for submit@debbugs.gnu.org; Sun, 14 Feb 2021 05:38:41 -0500 Received: from colin.muc.de ([193.149.48.1]:46804 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lBEnW-00088R-Tj for control@debbugs.gnu.org; Sun, 14 Feb 2021 05:38:39 -0500 Received: (qmail 42753 invoked by uid 3782); 14 Feb 2021 10:38:33 -0000 Received: from acm.muc.de (p2e5d5f6c.dip0.t-ipconnect.de [46.93.95.108]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 14 Feb 2021 11:38:32 +0100 Received: (qmail 5896 invoked by uid 1000); 14 Feb 2021 10:38:32 -0000 Date: Sun, 14 Feb 2021 10:38:32 +0000 To: control@debbugs.gnu.org Subject: Merge bugs 45375 and 46400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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 (-) reassign 46400 emacs,cc-mode merge 45375 46400 quit -- Alan Mackenzie (Nuremberg, Germany). From unknown Sat Jun 21 12:12:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45375: cc-mode indentation sometimes doesn't work Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 14 Feb 2021 11:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45375 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: confirmed To: Herman, =?UTF-8?Q?G=C3=A9za?= Cc: "Basil L. Contovounesios" , 46400@debbugs.gnu.org, 45375@debbugs.gnu.org Received: via spool by 45375-submit@debbugs.gnu.org id=B45375.161330109910125 (code B ref 45375); Sun, 14 Feb 2021 11:12:02 +0000 Received: (at 45375) by debbugs.gnu.org; 14 Feb 2021 11:11:39 +0000 Received: from localhost ([127.0.0.1]:35506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBFJT-0002d9-0o for submit@debbugs.gnu.org; Sun, 14 Feb 2021 06:11:39 -0500 Received: from colin.muc.de ([193.149.48.1]:47614 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lBFJP-0002cn-Eo for 45375@debbugs.gnu.org; Sun, 14 Feb 2021 06:11:38 -0500 Received: (qmail 64687 invoked by uid 3782); 14 Feb 2021 11:11:28 -0000 Received: from acm.muc.de (p2e5d5f6c.dip0.t-ipconnect.de [46.93.95.108]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 14 Feb 2021 12:11:28 +0100 Received: (qmail 5941 invoked by uid 1000); 14 Feb 2021 11:11:28 -0000 Date: Sun, 14 Feb 2021 11:11:28 +0000 Message-ID: References: <87r1ll9e9n.fsf@tcd.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) 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, Géza. On Sat, Feb 13, 2021 at 19:43:31 +0100, Herman, Géza wrote: > Hi all, > >> Can you still reproduce it on your end? > I'm using a ~3-week-old native-comp branch, this bug (#45375) doesn't > happen anymore for me. The bug was caused by an error in the handling of a cache (the "c-state-cache" which tracks the position of certain braces/brackets/parenthese). I can assure you the error is still there, even if it isn't currently triggering very often. > Note that the bisect gave a different commit for #46400, so maybe the > issues are different, even though the symptoms are very similar (same?). In bug #46400, I think Konstantin's bisecting threw up the wrong commit, since cache bugs tend to be very slippery to pin down. > Thank you for looking at this! A pleasure! I intend to commit the patch below in a few days time, if I don't hear back from anybody that it's giving trouble. This patch fixes the bug when applied to that commit from December (9022df70270243f211c54ccd66800320148b8434). It should apply cleanly to master. > Geza Hello, Konstantin. >> I don't think the bug was introduced by the commit you cite, more >> likely that commit triggered the bug which was lying in wait elsewhere. >> I've been working on this bug for several hours, so far, and have found >> that the "c-state-cache" (which records the positions of certain >> braces, brackets and parentheses) becomes corrupt while running your >> `test' function. I'm trying to track down where and how this >> corruption happens. >> Also relevant is that the bug seems to be being triggered by the >> apostrophe in >> bar("Couldn't open %s", to); >> ^ >> .. At least, if I take that apostrophe away, I don't see the bug >> symptoms any more. Actually, I was mistaken on this front - the apostrophe had nothing to do with it. >> So, please bear with me some while longer. I am working on the bug. > D: Oh, this is cool! Sure, thank you very much for looking into it! I'm > definitely not in hurry, I was just kinda being afraid that the report > could've gotten through the cracks. I'm happy to hear that wasn't the > case � It was indeed a bug in the c-state-cache handling, and I now have a patch to fix it. After applying the patch, the `test' function no longer produces a newline without indentation. There is something complicated going on with `undo', so that `test' sometimes reports there is no more undo data, but the indentation left on new lines is always correct. As I said above, I intend to commit the patch below in a few days time. Please feel free to apply it (to master) and test it out. I would be happy to hear of anything to do with this bug which is still not working. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 68dadcc272..653c4332b6 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -4314,38 +4314,29 @@ c-invalidate-state-cache-1 (setq c-state-nonlit-pos-cache-limit (1- here))) (c-truncate-lit-pos-cache here) - ;; `c-state-cache': - ;; Case 1: if `here' is in a literal containing point-min, everything - ;; becomes (or is already) nil. - (if (or (null c-state-cache-good-pos) - (< here (c-state-get-min-scan-pos))) - (setq c-state-cache nil - c-state-cache-good-pos nil - c-state-min-scan-pos nil) - - ;; Truncate `c-state-cache' and set `c-state-cache-good-pos' to a value - ;; below `here'. To maintain its consistency, we may need to insert a new - ;; brace pair. - (let ((here-bol (c-point 'bol here)) - too-high-pa ; recorded {/(/[ next above or just below here, or nil. - dropped-cons) ; was the last removed element a brace pair? - ;; The easy bit - knock over-the-top bits off `c-state-cache'. - (while (and c-state-cache - (>= (c-state-cache-top-paren) here)) - (setq dropped-cons (consp (car c-state-cache)) - too-high-pa (c-state-cache-top-lparen) - c-state-cache (cdr c-state-cache))) - - ;; Do we need to add in an earlier brace pair, having lopped one off? - (if (and dropped-cons - (<= too-high-pa here)) - (c-append-lower-brace-pair-to-state-cache too-high-pa here here-bol)) - (if (and c-state-cache-good-pos (< here c-state-cache-good-pos)) - (setq c-state-cache-good-pos - (or (save-excursion - (goto-char here) - (c-literal-start)) - here))))) + (cond + ;; `c-state-cache': + ;; Case 1: if `here' is in a literal containing point-min, everything + ;; becomes (or is already) nil. + ((or (null c-state-cache-good-pos) + (< here (c-state-get-min-scan-pos))) + (setq c-state-cache nil + c-state-cache-good-pos nil + c-state-min-scan-pos nil)) + + ;; Case 2: `here' is below `c-state-cache-good-pos', so we need to amend + ;; the entire `c-state-cache' data. + ((< here c-state-cache-good-pos) + (let* ((res (c-remove-stale-state-cache-backwards here)) + (good-pos (car res)) + (scan-backward-pos (cadr res)) + (scan-forward-p (car (cddr res)))) + (if scan-backward-pos + (c-append-lower-brace-pair-to-state-cache scan-backward-pos here)) + (setq c-state-cache-good-pos + (if scan-forward-p + (c-append-to-state-cache good-pos here) + good-pos))))) ;; The brace-pair desert marker: (when (car c-state-brace-pair-desert) -- Alan Mackenzie (Nuremberg, Germany). From unknown Sat Jun 21 12:12:46 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: Herman, =?UTF-8?Q?G=C3=A9za?= Subject: bug#45375: closed (Re: bug#46400: bug#45375: cc-mode indentation sometimes doesn't work) Message-ID: References: X-Gnu-PR-Message: they-closed 45375 X-Gnu-PR-Package: emacs,cc-mode X-Gnu-PR-Keywords: confirmed Reply-To: 45375@debbugs.gnu.org Date: Tue, 23 Feb 2021 11:33:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1614079982-26792-1" This is a multi-part message in MIME format... ------------=_1614079982-26792-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45375: cc-mode indentation sometimes doesn't work which was filed against the emacs,cc-mode package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45375@debbugs.gnu.org. --=20 45375: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45375 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1614079982-26792-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45375-done) by debbugs.gnu.org; 23 Feb 2021 11:32:09 +0000 Received: from localhost ([127.0.0.1]:58434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEVvF-0006wR-AK for submit@debbugs.gnu.org; Tue, 23 Feb 2021 06:32:09 -0500 Received: from colin.muc.de ([193.149.48.1]:54499 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lEVvD-0006w5-BU for 45375-done@debbugs.gnu.org; Tue, 23 Feb 2021 06:32:07 -0500 Received: (qmail 53330 invoked by uid 3782); 23 Feb 2021 11:32:01 -0000 Received: from acm.muc.de (p4fe15b08.dip0.t-ipconnect.de [79.225.91.8]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 23 Feb 2021 12:32:00 +0100 Received: (qmail 17545 invoked by uid 1000); 23 Feb 2021 11:32:00 -0000 Date: Tue, 23 Feb 2021 11:32:00 +0000 To: Herman@debbugs.gnu.org, =?iso-8859-1?Q?G=E9za?= Subject: Re: bug#46400: bug#45375: cc-mode indentation sometimes doesn't work Message-ID: References: <87r1ll9e9n.fsf@tcd.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45375-done Cc: "Basil L. Contovounesios" , 45375-done@debbugs.gnu.org, 46400-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, Géza. On Sun, Feb 14, 2021 at 11:11:28 +0000, Alan Mackenzie wrote: > On Sat, Feb 13, 2021 at 19:43:31 +0100, Herman, Géza wrote: [ .... ] > In bug #46400, I think Konstantin's bisecting threw up the wrong commit, > since cache bugs tend to be very slippery to pin down. > > Thank you for looking at this! > A pleasure! I intend to commit the patch below in a few days time, if I > don't hear back from anybody that it's giving trouble. This patch fixes > the bug when applied to that commit from December > (9022df70270243f211c54ccd66800320148b8434). It should apply cleanly to > master. I have now applied the patch to all the relevant places, and I am closing the bugs with this post. [ .... ] > > Geza -- Alan Mackenzie (Nuremberg, Germany). ------------=_1614079982-26792-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Dec 2020 23:02:29 +0000 Received: from localhost ([127.0.0.1]:51159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krqfk-0007RG-P5 for submit@debbugs.gnu.org; Tue, 22 Dec 2020 18:02:28 -0500 Received: from lists.gnu.org ([209.51.188.17]:50454) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krqfh-0007R6-Gh for submit@debbugs.gnu.org; Tue, 22 Dec 2020 18:02:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krqff-0007p1-Qz for bug-gnu-emacs@gnu.org; Tue, 22 Dec 2020 18:02:25 -0500 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:38399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1krqfd-0001jY-5J for bug-gnu-emacs@gnu.org; Tue, 22 Dec 2020 18:02:23 -0500 Received: by mail-ej1-x629.google.com with SMTP id 6so20371705ejz.5 for ; Tue, 22 Dec 2020 15:02:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=tqCB6gDxSjfi8xbeRvIWcQtv/dT7Por7J8BwUet9m58=; b=CIrIuxO/DtQmFDXga8PO2V8f6tg2nPVt/NWi6S7hLwHRbE6gM/ghRxd1O7kOpwTvzX fn9k00BVJy49wLFtzgfjKZFugklCQmsYi28CXoVqE6l9/jsM4ydqokDJ8Q8WXjlXjirt +mw2zplktgqNObPppNZYtIDs2bnvFhHZtXDA2cpkS7NnJK3c52nrvmraJS0FGokkRtAg HBQywK9xaMQCMglbgHGOKnMrQDR4Y4U6+CBB8Q2pH8LYROBdi7JcfxXExxxBIcHL9WL2 xGMwFgh66V9byCbt9KbJ7tgPRK/N9WgQt1SmR2+MlgT7wTLV0Ho4vlnnUn+jggEPKBNj jKuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=tqCB6gDxSjfi8xbeRvIWcQtv/dT7Por7J8BwUet9m58=; b=b1d2YxXaV/Tn9M6VrhC3ey+wQ1cPYtManLMcIOeG4RPjPocNI9MsOt5n+amE7fhWeZ E8aunORBtK3UVK40MUF+P35blCO0sQfGrzwirOr0rWfrGW8wqc43DNgaM2RUmC8ZIzSf ALZewr8UpGvObQ2c5iWQ3rIMGL+h1dzVhO4JEkOe/XuhiCDyV8TCn3eWVF17VarGp2NP IkAytp34gZjKswQjXumpBBuffPluS75doGdmlGDG2d2GWikXNATHciRyztprE1ris4Hk FcI5mIwVVuXblZNngy/+ejlZJ9KMN8rCWV9Bo3r1WYLEWxtYk75ZZqIjggwHdJj1Hwlc oB2g== X-Gm-Message-State: AOAM531w8UcRBNbdeurgQlasU1mlHV3ygQgpruiFNBKSAYqQ9Tw7v8mw jJckkq7doeF+YIlQ0sVft4s= X-Google-Smtp-Source: ABdhPJz9I17iO4X2YHV+wppFukDjZAXDFXwfYQESZ/9oKxPzHkPVP/WnhvoLTk6B5fzSaQJqxNXkuQ== X-Received: by 2002:a17:907:1009:: with SMTP id ox9mr21765276ejb.37.1608678139029; Tue, 22 Dec 2020 15:02:19 -0800 (PST) Received: from [192.168.8.4] (netacc-gpn-34-122-8.pool.telenor.hu. [37.234.122.8]) by smtp.gmail.com with ESMTPSA id v18sm29915324edx.30.2020.12.22.15.02.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Dec 2020 15:02:18 -0800 (PST) To: bug-gnu-emacs@gnu.org From: =?UTF-8?Q?Herman=2c_G=c3=a9za?= Subject: cc-mode indentation sometimes doesn't work Message-ID: Date: Wed, 23 Dec 2020 00:02:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: sv-FI Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=geza.herman@gmail.com; helo=mail-ej1-x629.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, 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-Spam-Score: -1.3 (-) 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: -2.3 (--) On current master (6af31fd71ff1a403c199c479577bcc145a547db1) indentation of C/C++ files sometimes doesn't work. I've bisected it: commit "9022df7027 Optimise c-parse-state for large buffers with few (if any) braces." introduced this behavior. This is how to reproduce: check out 9022df70270243f211c54ccd66800320148b8434, and execute "emacs -Q xdisp.c". Jump to line 2989 with M-g M-g 2989, move the cursor to the end of line of "Lisp_Object retval;", and press enter. The cursor will be moved to the correct place (correctly indented, cursor will be placed below the 'L' character of the previous line). Then push enter at end of line of "va_list ap;". For me, cursor will jump to the beginning of the line, it won't be indented. If I keep pressing enters, the next failure will be at "va_end (ap);". I'm not sure whether this exact steps reproduces for everyone, but it happened me 5 of 5 trials. If I don't press enter at the first line ("Lisp_Object retval;"), the problem doesn't happen for any of this function lines. But it will happen for somewhere else, if I keep trying (move around the file, press enter at random places: if will fail sooner or later). For my configuration (without -Q), this problem happens quite frequently during editing C++ code. ------------=_1614079982-26792-1-- From unknown Sat Jun 21 12:12:46 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: Konstantin Kharlamov Subject: bug#46400: closed (Re: bug#46400: bug#45375: cc-mode indentation sometimes doesn't work) Message-ID: References: <55f73bef46901e7c23de9161e3ba938cd2803d4b.camel@yandex.ru> X-Gnu-PR-Message: they-closed 46400 X-Gnu-PR-Package: emacs,cc-mode X-Gnu-PR-Keywords: confirmed Reply-To: 46400@debbugs.gnu.org Date: Tue, 23 Feb 2021 11:33:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1614079982-26792-3" This is a multi-part message in MIME format... ------------=_1614079982-26792-3 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45375: Sporadically breaking newline-indentation in c-mode which was filed against the emacs,cc-mode package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 46400@debbugs.gnu.org. --=20 45375: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45375 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1614079982-26792-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45375-done) by debbugs.gnu.org; 23 Feb 2021 11:32:09 +0000 Received: from localhost ([127.0.0.1]:58434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEVvF-0006wR-AK for submit@debbugs.gnu.org; Tue, 23 Feb 2021 06:32:09 -0500 Received: from colin.muc.de ([193.149.48.1]:54499 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lEVvD-0006w5-BU for 45375-done@debbugs.gnu.org; Tue, 23 Feb 2021 06:32:07 -0500 Received: (qmail 53330 invoked by uid 3782); 23 Feb 2021 11:32:01 -0000 Received: from acm.muc.de (p4fe15b08.dip0.t-ipconnect.de [79.225.91.8]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 23 Feb 2021 12:32:00 +0100 Received: (qmail 17545 invoked by uid 1000); 23 Feb 2021 11:32:00 -0000 Date: Tue, 23 Feb 2021 11:32:00 +0000 To: Herman@debbugs.gnu.org, =?iso-8859-1?Q?G=E9za?= Subject: Re: bug#46400: bug#45375: cc-mode indentation sometimes doesn't work Message-ID: References: <87r1ll9e9n.fsf@tcd.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45375-done Cc: "Basil L. Contovounesios" , 45375-done@debbugs.gnu.org, 46400-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, Géza. On Sun, Feb 14, 2021 at 11:11:28 +0000, Alan Mackenzie wrote: > On Sat, Feb 13, 2021 at 19:43:31 +0100, Herman, Géza wrote: [ .... ] > In bug #46400, I think Konstantin's bisecting threw up the wrong commit, > since cache bugs tend to be very slippery to pin down. > > Thank you for looking at this! > A pleasure! I intend to commit the patch below in a few days time, if I > don't hear back from anybody that it's giving trouble. This patch fixes > the bug when applied to that commit from December > (9022df70270243f211c54ccd66800320148b8434). It should apply cleanly to > master. I have now applied the patch to all the relevant places, and I am closing the bugs with this post. [ .... ] > > Geza -- Alan Mackenzie (Nuremberg, Germany). ------------=_1614079982-26792-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 9 Feb 2021 12:46:13 +0000 Received: from localhost ([127.0.0.1]:52850 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9SPE-0005lb-I1 for submit@debbugs.gnu.org; Tue, 09 Feb 2021 07:46:13 -0500 Received: from lists.gnu.org ([209.51.188.17]:55612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9SPA-0005lQ-4j for submit@debbugs.gnu.org; Tue, 09 Feb 2021 07:46:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9SP9-0007u7-C8 for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 07:46:07 -0500 Received: from forward104o.mail.yandex.net ([2a02:6b8:0:1a2d::607]:52060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9SP1-0001uD-2F for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 07:46:05 -0500 Received: from sas1-d4a7cb224acf.qloud-c.yandex.net (sas1-d4a7cb224acf.qloud-c.yandex.net [IPv6:2a02:6b8:c14:494:0:640:d4a7:cb22]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 6F79B9403A1 for ; Tue, 9 Feb 2021 15:45:43 +0300 (MSK) Received: from sas1-37da021029ee.qloud-c.yandex.net (sas1-37da021029ee.qloud-c.yandex.net [2a02:6b8:c08:1612:0:640:37da:210]) by sas1-d4a7cb224acf.qloud-c.yandex.net (mxback/Yandex) with ESMTP id 4eh8ut516V-jhIOLx4s; Tue, 09 Feb 2021 15:45:43 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1612874743; bh=BFDjcv6KSMKpUBUUz2u8g2yog1v8xqNgsaJuLvzVGiM=; h=To:From:Subject:Message-ID:Date; b=gKdpQXY1M0Lo7Mp3C36E8CQqXylM5Ie76QoQ9YArfPCGrkobl7W+NyVQjqXeXkakB zgyHkpVck8WpLv/+1/mhuJO3Dx5uHL9sCf/SVRqLYT/G+CV8vkVzTNggMwk1Ud3IW4 qP6AliI4XVxEWpYD9Y+EUC62lBhWJdzACRa2Mgz8= Authentication-Results: sas1-d4a7cb224acf.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by sas1-37da021029ee.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id wcmqDb5WQ1-jgn8UM2S; Tue, 09 Feb 2021 15:45:42 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: <55f73bef46901e7c23de9161e3ba938cd2803d4b.camel@yandex.ru> Subject: Sporadically breaking newline-indentation in c-mode From: Konstantin Kharlamov To: bug-gnu-emacs@gnu.org Date: Tue, 09 Feb 2021 15:45:42 +0300 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a02:6b8:0:1a2d::607; envelope-from=hi-angel@yandex.ru; helo=forward104o.mail.yandex.net 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) 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: -2.3 (--) This is a regression, but I'm not sure when it was introduced. Upon pressing RET, sometimes indentation gets inserted and you get the caret is on top of indentation; other times no indentation is inserted and the caret ends up at the beginning of a new line. There is not pattern, and both cases may happen many times in the row upon pressing RET. It is worth noting that this only happens in certain syntax parts of c-code. To reproduce the problem you basically put the caret at certain location in text, and spam RET and undo till some "RET" results in no indentation inserted (indentation seems expected by default, so it's not expected bahavior). # Steps to reproduce 1. Create /tmp/.emacs file with the following content: (defun test () (let ((i 0) (searching t)) (while (and (< i 10) searching) (setq i (+ i 1)) (call-interactively 'newline) (if (eq (line-beginning-position) (point)) (setq searching nil) (call-interactively 'undo)) ) (format "exiting with i = %d" i))) 2. Create `test.c` file with the following content: void foo() { if (-1 == dest) { bar("Couldn't open %s", to); goto exit; } } 3. Run emacs as `env HOME=/tmp/ emacs test.c` 4. Put caret at the end of `bar("Couldn't open %s", to);` text, right after the semicolon 5. Evaluate (test) NOTE: to make this work I had to evaluate the 5-th step twice. The reason is that `undo` in here behaves oddly: often it just refuses to undo with "No further undo unformation", thus making function evaluation stop. I'm not sure what to do about that problem; however repeating the call second time seems to always reproduce the problem for me. ## Expected Whenever `(test)` completes, the text is unchanged. ## Actual At some point you end up with caret being at the beginning of a new line (i.e. no indentation on that line) # Version Latest Emacs build: GNU Emacs 28.0.50 (build 12, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.17.4) of 2021-02-09 Also tested on a build from a few weeks ago, commit 9503f8d96c ------------=_1614079982-26792-3--