[Top][All Lists]

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

Re: Some problems in `add-log-current-defun'

From: Masatake YAMATO
Subject: Re: Some problems in `add-log-current-defun'
Date: Wed, 27 Dec 2006 22:46:07 +0900 (JST)

> >> Please note that we are talking about implementing editor support, not
> >> a C++ parser.  It is not our task to handle all C++ constructs
> >> perfectly.  Instead, it is our task to handle reasonably formatted C++
> >> code.  Code like the above may _intentionally_ be formatted in this
> >> manner in order to persuade the editor to interpret things
> >> differently.
> >
> > Just a question.
> >
> > Here do you think Emacs's C code is reasonably formatted?
> I can't parse your message; maybe it is not reasonably formatted...

I'm very sorry.
What I'd like to write:

  Do you think that Emacs's C code is reasonably formatted?

> The examples were C++ code mostly.  So what is "here" and "Emacs' C
> code" supposed to be?  Some code from the previous mail, or code from
> within Emacs?  An actual quote might be helpful.

C source within Emacs. Here I quote the related statements:
> II. On the change of `beginning-of-defun' in CC mode
> When the point is in the docstring of Emacs C source code, the
> following forms are evaluated.
>     (let (maybe-beg)
>       ;; Try to find the containing defun.
>       (beginning-of-defun)
>       (end-of-defun)
> But I found the result is wrong with the newest CC mode.  Consider the
> following Emacs C source code:
>     DEFUN ("catch", Fcatch, Scatch, 1, UNEVALLED, 0,
>            doc: /* Eval BODY allowing nonlocal exits using `throw'.
>     TAG is evalled to get the tag to use; it must not be nil.
>     Then the BODY is executed.
>     Within BODY, a call to `throw' with the same TAG exits BODY and this 
> `catch'.
>     If no throw happens, `catch' returns the value of the last BODY form.
>     If a throw happens, it specifies the value to return from `catch'.
>     usage: (catch TAG BODY...)  */)
> Now suppose the point is at the beginning of the second paragarph,
> i.e. before ``Then''.  This is where the point will be before
> evaluating the forms given above if one invokes
> `add-log-current-defun' when the point is in the first paragraph of
> the docstring.  In the past, CC mode does not consider the arguments
> of DEFUN as a defun, so `beginning-of-defun' will move point to the
> beginning of the function that appear before this DEFUN.  With the
> forms in `add-log-current-defun', the result is correct.  But I found
> in the newest CC mode considers the arguments (starting with
> ``("catch"'', ending with ``*/)'') as a defun, so that
> `beginning-of-defun' will move point to the beginning of the
> arguments, i.e. between the space that is after ``DEFUN'' and the left
> paren before ``"catch"''.  As a result, one cannot produce correct
> change log entry when point is in the first paragraph of this
> function, for example, when point is between ``Eval'' and ``BODY'' in
> the first paragraph.

Masatake YAMATO

reply via email to

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