emacs-devel
[Top][All Lists]
Advanced

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

Re: simplifying beginning-of-defun


From: Stefan Monnier
Subject: Re: simplifying beginning-of-defun
Date: Sun, 27 Sep 2009 18:52:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> We already have beginning-of-defun and beginning-of-defun-raw exactly
>> for these kinds of reasons.
> Ok.  I didn't research before responding. ;)
> I just now grepped around, and no programs use beginning-of-defun-raw,
> but they do use beginning-of-defun, and some use
> MODE-beginning-of-defun.

Yes, this area is sufficiently messy (and different between versions
and flavors of Emacs) that only the main entry point is ever used.

> I think there are these variants:

> * A program wants the default behavior
> * A major mode wants to change the interactive form
> * A program wants use the major-mode behavior
> * A third tool (ie - cedet) wants to change the interactive forms
>   without breaking the above three, and without modifying the global map

I can't think of a reason why #3 wouldn't want to be affected by #4.
Note that for #2, it's not just the interactive form, since it also
affects #3 (e.g. mark-defun, send-defun-to-inferior-process, younameit,
...).

> That is one solution, though I'm not sure about the
> beginning-of-defun-function setting, as the major mode may expect the
> function to be set as done in the major-mode.

Yes, it appears that some major-mode that set
beginning-of-defun-function also call beginning-of-defun, so there's
a chance that one of those calls actually is wrong and should call the
major-mode's code rather than going through beginning-of-defun-function.
It's OK: such bugs need to be fixed, it's not CEDET's responsibility if
the major mode breaks in this case.

>> I think that interactive/noninteractive is not the right distinction
>> (there are non-interactive cases which would also benefit from using an
>> improved implementation).  It's probably the best (conservative)
>> solution you could use, because the right solution requires more changes
>> to other packages.
[...]
> I think of CEDET as being able to 'glitz' up functions like
> beginning-of-defun by making them accurate.  Programs that actually want
> to use CEDET to get the more accurate behavior will not use
> 'beginning-of-defun' at all.

What about programs that want to use CEDET but that also want to work
when CEDET is not available?  They would most likely want to use
beginning-of-defun.


        Stefan




reply via email to

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