unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: acm@muc.de, 46400@debbugs.gnu.org,
	"Géza Herman" <geza.herman@gmail.com>,
	45375@debbugs.gnu.org
Subject: bug#46400: bug#45375: cc-mode indentation sometimes doesn't work
Date: Sat, 13 Feb 2021 14:39:27 +0000	[thread overview]
Message-ID: <YCfkny+MfPhuDnzJ@ACM> (raw)
In-Reply-To: <87r1ll9e9n.fsf@tcd.ie>

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 <geza.herman@gmail.com> 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).





  reply	other threads:[~2021-02-13 14:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 23:02 bug#45375: cc-mode indentation sometimes doesn't work Herman, Géza
2021-02-12 21:17 ` Basil L. Contovounesios
2021-02-13 14:39   ` Alan Mackenzie [this message]
2021-02-13 18:43     ` bug#46400: " Herman, Géza
2021-02-14 11:11       ` Alan Mackenzie
2021-02-23 11:32         ` bug#46400: " Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YCfkny+MfPhuDnzJ@ACM \
    --to=acm@muc.de \
    --cc=45375@debbugs.gnu.org \
    --cc=46400@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=geza.herman@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).