bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31656: 26.1; `fill-paragraph' malformats in emacs-lisp-mode


From: Eli Zaretskii
Subject: bug#31656: 26.1; `fill-paragraph' malformats in emacs-lisp-mode
Date: Fri, 01 Jun 2018 18:10:24 +0300

> From: Stefan Guath <address@hidden>
> Date: Fri, 1 Jun 2018 16:34:31 +0200
> Cc: address@hidden, address@hidden
> 
>  > The very idea of shadowing the global `fill-column' in the first place 
> breaks the Principle Of Least
>  > Astonishment
> 
>  If that is so, then we should have gobs of astonished users since 1995.
> 
> Yes, the streets are flooded with them! But Emacs users are a tough crowd 
> that don't complain :)

I guess so.

>  >From my POV, the answer is clear: it allows users to have different
>  customizable defaults for fill-column in Emacs Lisp and elsewhere.
> 
> If that was the only intention, that functionality was already present (I 
> guess way long before 1995) by just
> doing:
> (add-hook 'emacs-lisp-mode-hook (lambda () (setq fill-column 80))) 
> ;fill-column is buffer-local

Sure, but then everyone would need to write a mode hook, don't you
think?  With a separate option, things "just work".

>  E.g., in text modes, it is customary to enlarge the default to 79 or
>  thereabouts, but in Emacs Lisp we generally say that good style is to
>  make lines in doc strings no wider than 60 characters (see the ELisp
>  manual).
> 
> Doc strings, sure. But outside doc string, as it behaves now? Nah.

Maybe we should simply advise against using M-q outside of doc strings
and comments?  I agree with Noam that M-q elsewhere makes very little
sense.

> But even if that was the case, then just use
> the buffer local fill-column in a hook (as above). No need to introduce 
> redundant mechanisms.

It isn't redundant, because with the additional option we can set up
things so that Emacs does TRT by default out of the box, and in most
cases no customization by users is necessary.

> Ok, I'll take a stab at the easy way out and just update the docs. When 
> looking at the implementation in the
> function lisp-fill-paragraph, the outer or-clause seems to separate two 
> cases: 1) if in a comment use
> fill-column, else 2) bind fill-column to emacs-lisp-docstring-fill-column and 
> call fill-paragraph. Does that seem
> to be correct?

Yes, I think so.

> In that case the current doc could be changed from "Value of `fill-column' to 
> use when filling a
> docstring..." to "Value of `fill-column' to use in emacs-elisp-mode except in 
> comments".

Sounds good, but I think we should also advise against using this
except inside doc strings (and perhaps any other strings).

> But I still think the original intent of emacs-lisp-docstring-fill-column (as 
> described in its current doc) is useful,
> and would of course prefer if we rather could update the implementation to 
> reflect that functionality instead. I'm
> just not knowledgeable enough to do a PR. Would it be difficult?

You mean, make it work only inside a doc string?  I guess that would
be possible, yes.

> BTW, as a side note, I just wanted to add that this bug report is of course a 
> very small detail. Also, if my
> language sounds a bit harsh, its just because I'm in a hurry. I'm really 
> grateful to you and the community for
> putting in all the hard work so that people like me can use such a superior 
> tool - thanks a million!

No need to apologize, there's nothing wrong with your language.

Thanks.





reply via email to

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