emacs-devel
[Top][All Lists]
Advanced

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

Re: Mysterious fontification/C++ context issue - Patch for beginning-of-


From: David Kastrup
Subject: Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw.
Date: Sat, 16 Dec 2006 21:22:59 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

Chong Yidong <address@hidden> writes:

> martin rudalics <address@hidden> writes:
>
>> To elaborate on my last mail: I think the bug is in back_comment and may
>> affect any mode setting `open-paren-in-column-0-is-defun-start' to nil.
>> My gdb is currently on strike, so could someone please try to debug
>> where back_comment spends its time when applying scan_lists to
>> syms_of_xdisp?  Maybe there's an easy solution.
>>
>> Otherwise we'll have to set `open-paren-in-column-0-is-defun-start' to t
>> in C mode until someone fixes this.
>
> It's the part in syntax.c:701 which says
>
>  /* If we did not already find the defun start, find it now.  */
>  if (defun_start == 0)
>    {
>      defun_start = find_defun_start (comment_end, comment_end_byte);
>      defun_start_byte = find_start_value_byte;
>    }
>
> The trouble is that find_defun_start will scan from bob if
> open_paren... is 0:
>
>  static int
>  find_defun_start (pos, pos_byte)
>       int pos, pos_byte;
>  {
>    ...
>    if (!open_paren_in_column_0_is_defun_start)
>      {
>        find_start_value_byte = BEGV_BYTE;
>        return BEGV;
>      }

Well, it is not like an accident: this is defective by design.  Short
of having a column-0 heuristic, there is no way at all to find the
current nest level (and thus the function beginning) without counting
all braces from the start of the buffer.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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