[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: beginning-of-defun (again)
From: |
David Kastrup |
Subject: |
Re: beginning-of-defun (again) |
Date: |
Thu, 29 Oct 2015 14:28:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Oleh Krehel <address@hidden> writes:
> David Kastrup <address@hidden> writes:
>
>> Oleh Krehel <address@hidden> writes:
>>
>>> Hi Andreas,
>>>
>>> Andreas Röhler <address@hidden> writes:
>>>
>>>> maybe it's time to have a reasonable default-behavior of
>>>> beginning-of-defun in Emacs Lisp.
>>>
>>> I think it works pretty well as is.
>>>
>>>> open-paren-in-column-0-is-defun-start
>>>
>>> It's a strange variable that doesn't seem to do anything.
>>
>> Huh?
>
> Please give an example then. I'm not able to see a difference when it's
> unset.
>
>>> The only relevant setting is 0 or non-zero (the default).
>>
>> Huh?!? The only relevant settings are nil and non-nil.
>
> The only relevant use is:
>
> if (!open_paren_in_column_0_is_defun_start)
> {
> find_start_value = BEGV;
> find_start_value_byte = BEGV_BYTE;
> goto found;
> }
>
> Note that it's not checked against Qnil. It may be that Qnil is
> conveniently defined to be 0 though, I'm not sure.
open_paren_in_column_0_is_defun_start is a C variable. You were talking
about open-paren-in-column-0-is-defun-start which is a Lisp variable.
It is defined using DEFVAR_BOOL:
@code{DEFVAR_BOOL} makes a C variable of type @code{int} visible in
Lisp with a value that is either @code{t} or @code{nil}. Note that
variables defined with @code{DEFVAR_BOOL} are automatically added to
the list @code{byte-boolean-vars} used by the byte compiler.
>> Speeds up syntax highlighting by giving it anchor points. If you
>> encounter
>>
>> (
>>
>> in a file, that counts as the start of some list even without looking
>> whether it might be part of something like
>
> I see. I wonder what the speed-up factor is.
Can be significant depending on the file.
> For example in org.el.
>
>>>> A function resp. top-level-form starts if the beginning of a list is
>>>> followed by a respective keyword.
>>>> The list of keywords being customizable seems a plus :)
>>>
>>> There's no reason for a defun to not start on a newline.
>>
>> But there's a reason for non-defuns to start on a newline.
>
> I call these defuns anyway.
Then you should be happy with the default setting.
--
David Kastrup
- beginning-of-defun (again), Andreas Röhler, 2015/10/29
- Re: beginning-of-defun (again), John Wiegley, 2015/10/29
- Re: beginning-of-defun (again), Richard Stallman, 2015/10/30
- Re: beginning-of-defun (again), Alan Mackenzie, 2015/10/30
- Re: beginning-of-defun (again), John Wiegley, 2015/10/30