Javier Olaechea <pir...@gmail.com> writes: > org-comment-line-break-function does not handle fill-prefix being set to > nil, which is the default value for fill-prefix. This means that pressing > M-j inside an org-mode buffer in a vanilla installation of Emacs results in > an error. From looking at other callers of > insert-before-markers-and-inherit it is clear that a guard against > fill-prefix being nil is missing.
I guess this is fine to fix the immediate error, but I do not see much point in the whole org-comment-line-break function. AFAIU, it does not even recognise whether we are inside comment or not. I just tried to use the default comment-indent-new-line and it correctly indents paragraphs and also comments. On the other hand, it does not indent item lists and src-blocks. Rather than applying this patch I would remove org-comment-line-break-function alltogether. It will already be better than the current state. Alternatively, it should be rewritten to take into account current element context, similar to org-insert-comment. Best, Ihor