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

From: Lennart Borgman <[email-masked]>
Date: Fri, 31 Jul 2009 02:52:02 +0200

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