unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour
@ 2016-06-22  0:19 Rolf Ade
       [not found] ` <mailman.1962.1466554808.1216.bug-gnu-emacs@gnu.org>
       [not found] ` <mailman.2009.1466608581.1216.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Rolf Ade @ 2016-06-22  0:19 UTC (permalink / raw)
  To: 23818


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





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-08-13 13:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-22  0:19 bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour Rolf Ade
     [not found] ` <mailman.1962.1466554808.1216.bug-gnu-emacs@gnu.org>
2016-06-22  8:54   ` Alan Mackenzie
2016-06-22 15:14     ` Eli Zaretskii
2016-06-24 15:02   ` Alan Mackenzie
2016-06-28 23:22     ` bug#23775: " Rolf Ade
2016-06-29 20:26       ` Alan Mackenzie
2016-06-29 20:27       ` Alan Mackenzie
2016-06-29  0:57     ` Rolf Ade
2017-08-08 21:42       ` Rolf Ade
2017-08-13 13:17         ` Alan Mackenzie
     [not found] ` <mailman.2009.1466608581.1216.bug-gnu-emacs@gnu.org>
2016-06-24 14:43   ` Alan Mackenzie

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