GNU bug report logs - #23818
25.0.95.3: c-beginning-of-defun misbehaviour

Previous Next

Packages: emacs, cc-mode;

Reported by: Rolf Ade <rolf <at> pointsman.de>

Date: Wed, 22 Jun 2016 00:20:02 UTC

Severity: normal

Found in version 25.0.95.3

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Rolf Ade <rolf <at> pointsman.de>
Subject: bug#23818: closed (Re: bug#23818: 25.0.95.3: c-beginning-of-defun
 misbehaviour)
Date: Sun, 13 Aug 2017 13:19:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#23818: 25.0.95.3: c-beginning-of-defun misbehaviour

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 23818 <at> debbugs.gnu.org.

-- 
23818: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23818
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: Rolf Ade <rolf <at> pointsman.de>
Cc: 23818-done <at> debbugs.gnu.org
Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour
Date: Sun, 13 Aug 2017 13:17:18 +0000
Hello, Rolf

On Tue, Aug 08, 2017 at 23:42:36 +0200, Rolf Ade wrote:

> Hi Alan,

> while searching for something else I saw it bug is still open. It's
> fixed and good, but just not closed. (Somehow, the following exchanges
> about this bug landed in bug#23775.) Clean up and mark as done.

Yes, there was a bit of confusion back then.  Sorry about that.

With this Email, I'm closing bug #23818.  Thanks for the reminder.

> rolf

-- 
Alan Mackenzie (Nuremberg, Germany).

[Message part 3 (message/rfc822, inline)]
From: Rolf Ade <rolf <at> pointsman.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.95.3: c-beginning-of-defun misbehaviour
Date: Wed, 22 Jun 2016 02:19:21 +0200
The same in 24.5 and 25.0.95.3:

emacs -Q

Open some random emtpy buffer foo.c, put it in c-mode (M-x c-mode) and
insert the following C code:

#define DBG(x) x

DBG(
static void __dbgAttr () {
    /* something */
}
)

int main (void) 
{
    int i;
    i++;
    i++;
    return i;
}

int foo () 
{
    int i;
    i++;
    i++;
    return 1;
}


Put the point inside function main and C-M-home (or M-x
c-beginning-of-defun). Instead of the beginning of main() the point is
here:

_P_DBG(
...

Far away from

_P_int main(void)
...


This isn't "unbalanced braces in preprocessor statements are
horrendously difficult to parse" as in bug #23775, there are no
unbalanced braces everywhere. It's that some code above the code of a
syntactical correct function disturbs c-beginning-of-defun in finding
the beginning of the function.

Put the point into or at the end of function foo, do C-M-home and you
are at the beginning of function foo. Do C-M-home again, and you are not
at the beginning of main, but of the beginning of DBG.

Remove the DBG(). Now C-M-home works, even if the point is inside or the
end of main().



This bug report was last modified 7 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.