Subject: Re: bug#22847: #17062: 24.3 current-fill-column breaks fill-match-adaptive-prefix

From: Eli Zaretskii <[email-masked]>
Date: Fri, 09 Dec 2016 10:08:29 +0200

> From: Glenn Morris <[email-masked]>
> cc: Eli Zaretskii <[email-masked]>
> Date: Thu, 08 Dec 2016 17:32:38 -0500
> 
> So this seems like a mess.

But a very old one.

> fill-column is documented to be an integer, and that is its custom-type.
> Nowhere does it say it can be nil, AFAICS.
> Many places in Emacs are not prepared for it (or current-fill-column) to
> be nil.
> 
> Yet 1e87252 explicitly added a check for a nil fill-column to
> current-fill-column. AFAICS, do-auto-fill is the only place in Emacs
> that tests for this, and uses it to disable auto-fill.
> 
> The only uses I find for "(setq fill-column nil)" are a few people using
> it in their .emacs to disable auto-fill (I guess) in some major mode.
> The idiomatic way to do this is just to turn off auto-fill in that mode.
> 
> TLDR:
> Let's remove the test for nil fill-column in current-fill-column.

I don't understand what you propose to do instead.
current-fill-column does arithmetics on fill-column when it's non-nil,
so we cannot just remove the test, because the function will then
signal an error.

I see 3 possible ways to fix these bugs:

  . Fix the code which is not prepared for fill-column being nil to be
    prepared.  This leaves everyone happy, except, perhaps, the person
    who would need to fix all those places in Emacs.

  . Change current-fill-column to return most-positive-fixnum when
    fill-column is nil.  This is an easy way out, but it might slow
    down do-auto-fill when fill-column is nil.  Not sure if we care
    about that slow down.

  . Disallow fill-column being nil and remove the test from
    current-fill-column without changing anything else, i.e. let it
    signal an error, perhaps with some text that tells this value is
    no longer supported.  This will break setups of those who use that
    value to disable auto-fill, something that was available since
    forever, so I don't think we can do that.

Comments?