emacs-devel
[Top][All Lists]
Advanced

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

Re: Minor bug in c-beginning-of-defun. May I fix it?


From: Chong Yidong
Subject: Re: Minor bug in c-beginning-of-defun. May I fix it?
Date: Tue, 17 Apr 2007 15:07:36 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.98 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> The fix is straightforward: The third argument NOERROR to a
> `c-syntactic-re-search-forward' should not be t; it should be something
> else non-nil.  So, when a search fails, point will be left at EOB rather
> than unmoved.  The argument `NOERROR' here has the same meaning it does
> in the Emacs core function `search-forward-regexp'.
>
> !                  (c-syntactic-re-search-forward "{" nil t))
> --- 1531,1537 ----
> !                  (c-syntactic-re-search-forward "{" nil 'eob))

Hi Alan,

I played around with your patch a little, and noticed that it
introduces a slight difference in the behavior of
c-beginning-of-defun.  Consider the following file (not including the
"----" characters, and including the final "\n\n"):

-------------------
int foo ()
{
  asdf;
  
  if (asdf)
    {
      bar;
    }
}

-------------------

With point at bob, do C-u -1 M-x c-beginning-of-defun RET.

Before the change, point moves to the newline just after the last }
character, and on the same line.  After the change, it moves one
additional line down.

I guess this is harmless, but could you double-check?  (Otherwise, the
change looks OK to me, assuming you've tested it out thoroughly.)




reply via email to

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