[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error message at line break
From: |
Nicolas Goaziou |
Subject: |
Re: error message at line break |
Date: |
Sat, 02 May 2020 19:33:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hello,
Étienne Deparis <address@hidden> writes:
> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
> insert-before-markers-and-inherit(nil)
> org-comment-line-break-function(t)
[...]
> 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?
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)))
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'.
WDYT?
Regards,
--
Nicolas Goaziou