emacs-orgmode
[Top][All Lists]
Advanced

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

Re: error message at line break


From: Étienne Deparis
Subject: Re: error message at line break
Date: Sun, 03 May 2020 17:47:12 +0200
User-agent: mu4e 1.4.3; emacs 26.3

Hello,

sam. 02 mai 2020 à 19:33, address@hidden a écrit :

> [...]
>
>> I confirm that I've the same variable set in my Emacs config file:
>>
>>   (setq-default auto-fill-function 'do-auto-fill)
>>
>> Which I take from the Emacs Wiki AutoFill page¹, with the explanation
>> of: « If you would like to enable auto fill for all major modes, you can
>> add this single line to your configuration ».
>>
>> ¹ https://www.emacswiki.org/emacs/AutoFillMode
>
> This is a very bad (outdated ?) advice! With this, you force
> `do-auto-fill' function in every major mode, even if that function
> doesn't have a clue about what the major mode is about. Also this
> prevents the major mode from setting its own filling. Do you have any
> reason to do this?

I must admit I have absolutely no reason to do so. I don't even remember
when this line appear in my config file. At the time, I think I wished
to have auto-fill-mode in all buffer and blindly copy-paste this code
without thinking about it.

>
> A correct way to activate auto fill in all text-based modes (including
> Org), is, for example,
>
>   (add-hook 'text-mode-hook (lambda () (auto-fill-mode 1)))

Yes, I agree you, with my today's Emacs knowledge it makes more
sense. I'll switch to that, or maybe completely remove it and see, mode
per mode, when I really need it.

>
> See (info "(emacs)Auto Fill") for more information.
>
>> To fix this, I simply replace the last line of
>> `org-comment-line-break-function' (in ./lisp/org.el, line 19723) from:
>>
>>   (insert-before-markers-and-inherit fill-prefix)
>>
>> To
>>
>>   (when fill-prefix
>>     (insert-before-markers-and-inherit fill-prefix))
>
> Well, the fix is cheap, sure, but, OTOH, the error is to be expected,
> since you force Org to use a function which is not adequate.
>
> I'm not sure we should paper over this kind of misuse of
> `auto-fill-function'.

With your explanations, I agree this fix proposal doesn't make sense,
and I understand and I agree the error expectation

Thank you Nicolas and Tim for your clarification. In the next day I'll
see to amend the EmacsWiki to note that this tip is outdated or
dangerous.


Enjoy your evening,

Étienne


>
> WDYT?
>
> Regards,


--
Étienne Deparis

https://etienne.depar.is/
xmpp: address@hidden



reply via email to

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