unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: Andreas Schwab <schwab@suse.de>,
	emacs-devel@gnu.org, A Soare <alinsoar@voila.fr>
Subject: Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken
Date: 18 Apr 2007 21:15:47 +0200	[thread overview]
Message-ID: <20070418203555.GB2100@muc.de> (raw)
In-Reply-To: <87zm55sgea.fsf@stupidchicken.com>

'Evening, Chong!

On Wed, Apr 18, 2007 at 02:10:05PM -0400, Chong Yidong wrote:
> Andreas Schwab <schwab@suse.de> writes:

> > c-end-of-defun no longer always goes to the end of the function.  This
> > breaks add-log-current-defun, for example.  It doesn't always happen, but
> > you can reproduce it with
> > <http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gdb/symtab.c?rev=1.157&content-type=text/plain&cvsroot=src>.
> > Just load the file and type M-C-e.  You end up in the middle of
> > lookup_partial_symtab instead of at the end of lookup_symtab.

> The trouble is the following code in c-end-of-defun (cc-cmds.el:1645):
> 
>       ;; Move forward to the } of a function
>       (if (> arg 0)
> 	  (setq arg (c-forward-to-nth-EOF-} arg where))))
> 
>     ;; Do we need to move forward from the brace to the semicolon?
>     (when (eq arg 0)
>       (if (c-in-function-trailer-p)	; after "}" of struct/enum, etc.
> 	  (c-syntactic-re-search-forward ";"))

> The function c-in-function-trailer-p thinks we are between the closing
> brace and the semicolon of struct construct, because this function
> returns a struct *:

>   struct symtab *
>   lookup_symtab (const char *name)
>   {

> Alan, can you come up with a quick fix?

Yes.

There is code which analyses `struct' headers properly in the function
`c-end-of-decl-1' in cc-engine.el.  I can copy this into
`c-in-function-trailer-p'.

I might be able to post a patch tonight.  If not, tomorrow.

-- 
Alan.

  reply	other threads:[~2007-04-18 19:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18 15:28 CC Mode 5.31.4 (C/l); c-end-of-defun broken Andreas Schwab
2007-04-18 17:32 ` Glenn Morris
2007-04-18 20:20   ` Alan Mackenzie
2007-04-18 18:10 ` Chong Yidong
2007-04-18 19:15   ` Alan Mackenzie [this message]
2007-04-18 20:11   ` Alan Mackenzie
2007-04-18 20:43     ` Chong Yidong
2007-04-18 21:27       ` Alan Mackenzie
2007-04-19 17:38         ` Alan Mackenzie
2007-04-19 18:17           ` Chong Yidong
2007-04-20 14:52             ` Richard Stallman
2007-04-20 15:08               ` Chong Yidong

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=20070418203555.GB2100@muc.de \
    --to=acm@muc.de \
    --cc=alinsoar@voila.fr \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@suse.de \
    /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).