Subject: Re: bug#3972: 23.1.50; c-mode sets M-q to c-fill-paragraph

From: Andrew Hyatt <[email-masked]>
Date: Thu, 11 Feb 2016 23:17:13 -0500

Lennart Borgman <[email-masked]> writes:

> On Thu, Jul 30, 2009 at 4:44 PM, Lennart
> Borgman<[email-masked]> wrote:
>> On Thu, Jul 30, 2009 at 3:40 PM, Lennart
>> Borgman<[email-masked]> wrote:
>>
>>> The problem I am actually fighting is a bit different I believe.
>>> c-fill-paragraph is a bit complicated so I am not sure. What I see
>>> when I am testing is that c-fill-paragraph works in some MuMaMo chunks
>>> (ie a chunk of the buffer with one major mode, other than in the
>>> chunks before and after it) and not others, though in both cases the
>>> major mode is php-mode. My guess so far is that it is because of a
>>> (widen) somewhere inside c-fill-paragraph that makes a call to
>>> something, perhaps to syntax-ppss or similar, come back with bad
>>> information (since it is influenced by contents in other chunks).
>>>
>>> What do you think about this guess?
>>
>> I tried to flet widen to ignore. That worked, but when trying to byte
>> compile I got:
>>
>>  mumamo.el:6734:57:Error: Byte-compiling a redefinition of `widen'
>> will not work - use `labels' instead
>>
>> But `labels' does a lexical binding, not a dynamic binding so that
>> obviously will not work. So now I don't know what to do...
>> defadvice...?
>
>
> I decided to use defadvice on `widen' (+ enable/disable) for the
> moment. It seems to work fine.
>
> However that c-fill-paragraph is bound to M-q is still a problem, I
> had to rebind that.
>
> I noticed some other problems:
>
> - The doc string for fill-paragraph-function does not say anything
> about the functions arguments.
> - The arguments to c-fill-paragraph is not the expected ones though it
> is used as fill-paragraph-function. (But it works - and I don't
> understand why at the moment...)
>
> Also the double role of c-fill-paragraph is perhaps a difficult design
> (it is used both for M-x and fill-paragraph-function).

This bug feels like a wishlist to me. I don't see a user-visible issue,
just (valid-seeming) design issues. The documentation does seem like a
potential bug, but I'd assume that any function defined in
fill-paragraph-function won't be called with any arguments, since they
aren't mentioned (and I'm not sure which arguments would make sense
anyway).

I'm going to mark this as wishlist, but feel free to disagree.