all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Change in fill-nobreak-predicate
@ 2005-02-05  0:43 Chong Yidong
  2005-02-05  2:02 ` Stefan Monnier
  2005-02-05 17:39 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Chong Yidong @ 2005-02-05  0:43 UTC (permalink / raw)


In 21.3, the variable fill-nobreak-predicate stored a function symbol.
This was changed in CVS, long ago, into a hook:

2001-10-30  Stefan Monnier  <monnier@cs.yale.edu>

	* textmodes/fill.el (sentence-end-double-space)
	(sentence-end-without-period): Move to paragraphs.el.
	(fill-indent-according-to-mode): Change default to t.
	(fill-context-prefix): Simplify control-flow and use a more
	sophisticated merge that unifies both previous checks.
	(fill-single-word-nobreak-p, fill-french-nobreak-p): New funs.
	(fill-nobreak-predicate): Make it into a defcustom'd hook.

This breaks third-party code that relies on fill-nobreak-predicate (such
as longlines.el), but never mind; the problem is that the NEWS entry does
not give any indication of this:

** You can now customize fill-nobreak-predicate to control where
filling can break lines.  We provide two sample predicates,
fill-single-word-nobreak-p and fill-french-nobreak-p.

+++

This makes it sound like the only change was to make it customizable, when
in fact its data type has changed.

The entry in lispref/text.texi should also be corrected:

@defvar fill-nobreak-predicate
This variable gives major modes a way to specify not to break a line at
certain places.  Its value should be a function.  This function is
called during filling, with no arguments and with point located at the
place where a break is being considered.  If the function returns
non-@code{nil}, then the line won't be broken there.
@end defvar

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change in fill-nobreak-predicate
  2005-02-05  0:43 Change in fill-nobreak-predicate Chong Yidong
@ 2005-02-05  2:02 ` Stefan Monnier
  2005-02-05  2:37   ` Chong Yidong
  2005-02-05 17:39 ` Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2005-02-05  2:02 UTC (permalink / raw)
  Cc: emacs-devel

> 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.


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change in fill-nobreak-predicate
  2005-02-05  2:02 ` Stefan Monnier
@ 2005-02-05  2:37   ` Chong Yidong
  2005-02-05 17:39     ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2005-02-05  2:37 UTC (permalink / raw)


>> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change in fill-nobreak-predicate
  2005-02-05  0:43 Change in fill-nobreak-predicate Chong Yidong
  2005-02-05  2:02 ` Stefan Monnier
@ 2005-02-05 17:39 ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2005-02-05 17:39 UTC (permalink / raw)
  Cc: emacs-devel

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change in fill-nobreak-predicate
  2005-02-05  2:37   ` Chong Yidong
@ 2005-02-05 17:39     ` Richard Stallman
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2005-02-05 17:39 UTC (permalink / raw)
  Cc: emacs-devel

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

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-02-05 17:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-05  0:43 Change in fill-nobreak-predicate Chong Yidong
2005-02-05  2:02 ` Stefan Monnier
2005-02-05  2:37   ` Chong Yidong
2005-02-05 17:39     ` Richard Stallman
2005-02-05 17:39 ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.