From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Some problems in `add-log-current-defun'
Date: Wed, 27 Dec 2006 16:17:18 -0500 [thread overview]
Message-ID: <E1Gzg9G-0002nd-I6@fencepost.gnu.org> (raw)
In-Reply-To: <BAY112-F34477621BF3C6EE6E473DBDAC00@phx.gbl> (herberteuler@hotmail.com)
But this is not reliable. If someone forgets to put a newline after a
function, `add-log-current-defun' will report wrong name. Please
consider the following example:
int
f1 ()
{
/* If point is here `add-log-current-defun' gets wrong result. */
}
int
f2 ()
{
/* ... */
}
When the point is inside the body of `f1', invoking
`add-log-current-defun' will get `f2', rather than `f1'.
That bug is worth fixing.
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,
That change in CC mode would clearly be a change for the better, but
it doesn't work for me.
I updated my sources yesterday around noon EST.
I find that `beginning-of-defun' when given inside the DEFUN args
of Fcatch moves back to the { at the start of the body of Fmacroexpand.
I also find that C-M-a is bound to `beginning-of-defun' in C mode.
Wasn't it supposed to be `c-beginning-of-defun' nowadays?
What is wrong here?
In any case, it would be good to change `add-log-current-defun'
to correspond to the new improved behavior of CC mode.
void ssort(void * base, size_t n, size_t sz, CFT cmp)
/*
Sort the "n" elements of vector "base" into increasing order
using the comparison function pointed to by "cmp".
The elements are of size "sz".
Shell sort (Knuth, Vol3, pg84)
*/
{
/* ... */
}
That seems like common usage -- not weird. It would be nice to handle
that usage correctly. However, if we have never handled it in the
past, I think it is not urgent to fix it now.
Masatake YAMATO <jet@gyve.org> thinks that code is badly formatted.
Masatake, why do you think so?
This is not general too: C++ permits the nested name to be put in many
lines. For example, the following name is valid:
void
class_1
::
sub_class_2
::
method_3 ()
{
/* ... */
}
The current implementation cannot handle this name correctly.
I'd say don't bother with that. At least not now.
next prev parent reply other threads:[~2006-12-27 21:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-27 10:32 Some problems in `add-log-current-defun' Herbert Euler
2006-12-27 10:45 ` David Kastrup
2006-12-27 11:48 ` Masatake YAMATO
2006-12-27 12:22 ` David Kastrup
2006-12-27 11:55 ` Masatake YAMATO
2006-12-27 13:46 ` Masatake YAMATO
2006-12-27 21:17 ` Richard Stallman [this message]
2006-12-28 12:41 ` Masatake YAMATO
2006-12-29 15:44 ` Richard Stallman
2006-12-30 4:55 ` Masatake YAMATO
2006-12-30 18:24 ` Richard Stallman
2006-12-28 12:47 ` Herbert Euler
2006-12-29 15:44 ` Richard Stallman
2006-12-29 3:10 ` Herbert Euler
-- strict thread matches above, loose matches on Subject: below --
2006-12-31 8:28 Herbert Euler
2006-12-31 22:13 ` Richard Stallman
2007-01-01 1:27 ` Herbert Euler
2007-01-02 23:35 ` Stefan Monnier
2007-01-03 21:11 ` Richard Stallman
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=E1Gzg9G-0002nd-I6@fencepost.gnu.org \
--to=rms@gnu.org \
--cc=emacs-devel@gnu.org \
/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).