bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Alan Mackenzie
Subject: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour
Date: 22 Jun 2016 08:54:29 -0000
User-agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE-p4 (amd64))

Hello, Rolf.

Thanks for the bug report.  I can reproduce it.

I will work on it in the coming hours and days.

-- 
Alan Mackenzie (Nuremberg, Germany).


In article <mailman.1962.1466554808.1216.bug-gnu-emacs@gnu.org> you wrote:

> 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().








reply via email to

[Prev in Thread] Current Thread [Next in Thread]