[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mysterious fontification/C++ context issue - Patch for beginning-of
Stuart D. Herring
Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw.
Fri, 15 Dec 2006 12:46:36 -0800 (PST)
>> Chong Yidong <address@hidden> writes:
>>> This binding should take place in CC-mode code; there's no
>>> reason to expect all beginning-of-defun functions to run with
>>> beginning-of-defun-function rebound to nil.
>> I think this is a reasonable expectation: if the custom b-o-d-f
>> wants to call itself, it can do so directly, and b-o-d-f needs to
>> be bound to nil at some point anyways to avoid recursion. It's
>> probably less error-prone to do it in just one place, rather than
>> letting each new foo-mode's foo-beginning-of-defun discover this
>> problem for itself.
> OTOH, there's no other place in Emacs that assumes that you should
> bind foo-function to nil before calling foo-function. That would be
> considered surprising behavior.
Most other places in Emacs aren't delegating a function's entire job, so
recursion isn't an issue. If it's thought better, I've attached a patch
that sets up b-o-d-f, e-o-d-f, and f-s-f (forward-sexp-function) to be
bound to nil while their values are being called, and updates the
docstrings accordingly. I've provided a ChangeLog below, although perhaps
a NEWS entry would be needed as well. (There might also be other files
that could apply this technique, but I don't want to do too much if it
turns out to be undesired.)
2006-12-15 Stuart D. Herring <address@hidden>
* emacs-lisp/lisp.el (forward-sexp-function,
beginning-of-defun-function, end-of-defun-function): Document
rebinding during use.
(forward-sexp): Bind `forward-sexp-function' to nil when calling
it, and document this.
(beginning-of-defun): Document rebinding of
`beginning-of-defun-function' during use.
(beginning-of-defun-raw): Bind `beginning-of-defun-function' to
nil when calling it, and document this.
(end-of-defun): Bind `end-of-defun-function' to nil when calling
it, and document this.
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
Description: Binary data
Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Chong Yidong, 2006/12/15
Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Stefan Monnier, 2006/12/15