emacs-devel
[Top][All Lists]
Advanced

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

Re: Change in fill-nobreak-predicate


From: Chong Yidong
Subject: Re: Change in fill-nobreak-predicate
Date: Fri, 4 Feb 2005 21:37:30 -0500 (EST)
User-agent: SquirrelMail/1.4.3a

>> This breaks third-party code that relies on fill-nobreak-predicate (such
>> as longlines.el), but never mind;
>
> Actually, hooks (for some old historical backward compatibility reason)
> can contain either a list of functions or a single function.
> So fill-nobreak-predicate can still be set to a single function, as in
> the past.
>
> I do not doubt that my change introduced some incompatibility, but most
> normal uses should work just as well as before.
> If not, please give us more information about the problem.

I had code calling (funcall fill-nobreak-predicate), which failed because
some modes, such as TeX mode, use the new hook mechanism and set
fill-nobreak-predicate to a list. Changing my code to
(run-hook-with-args-until-success fill-nobreak-predicate) fixed it.

Another thing: maybe the doc-string of run-hook-with-args-* should reflect
the fact that hook can be a function:

 run-hook-with-args-until-success is a built-in function in `C source code'.
 (run-hook-with-args-until-success hook &rest args)

 Run hook with the specified arguments args.
 hook should be a symbol, a hook variable.  Its value should
 be a list of functions.  We call those functions, one by one,
 passing arguments args to each of them, until one of them
 returns a non-nil value.  Then we return that value.
 If all the functions return nil, we return nil.

The docstring for run-hook-with-args is already correct:

 run-hook-with-args is a built-in function in `C source code'.
 (run-hook-with-args hook &rest args)

 Run hook with the specified arguments args.
 hook should be a symbol, a hook variable.  If hook has a non-nil
 value, that value may be a function or a list of functions to be
 called to run the hook.  If the value is a function, it is called with
 the given arguments and its return value is returned.  If it is a list
 of functions, those functions are called, in order,
 with the given arguments args.





reply via email to

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