emacs-devel
[Top][All Lists]
Advanced

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

Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken


From: Chong Yidong
Subject: Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken
Date: Wed, 18 Apr 2007 14:10:05 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.98 (gnu/linux)

Andreas Schwab <address@hidden> 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?




reply via email to

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