Hi Nicolas,

Thanks for you answer.
OK, I understand. That explains why I needed to add blank lines between list items before to fill region, such as:

  - item1

  - item2

  This is a new paragraph

I have 2 more questions for you please.
Let say I would like to give a hand and try to improve the org-fill-region to deal with this case.
- Would it be local to fill-region only, as I would suspect, or would it put a mess around because it is used in some other contexts I am not aware of, and would it be something interesting for the org-mode according to you?
- If you wanted to develop it, would you surround it with a when condition so that user can disable it?

Thanks,

Steve

2015-11-29 22:43 GMT+01:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:
Hello,

Steve Moreau <moreau.steve@free.fr> writes:

> Indeed, the org-setup-filling was concerned.
>
> *Before:*
>
>       (append fill-nobreak-predicate
>           '(org-fill-paragraph-separate-nobreak-p
>             ...
>
> (defvar org-element-paragraph-separate) ; org-element.el
> (defun org-fill-paragraph-separate-nobreak-p ()
>   "Non-nil when a new line at point would end current paragraph."
>   (looking-at (substring org-element-paragraph-separate 1)))
>
> *After:*
>
> 'org-fill-paragraph-separate-nobreak-p' predicate removed and the previous
> function has been deleted
>
> The following code has been added:
>
>   (let ((paragraph-ending (substring org-element-paragraph-separate 1)))
>     (org-set-local 'paragraph-start paragraph-ending)
>     (org-set-local 'paragraph-separate paragraph-ending))
>
>
> Could someone explain to me why the function has been removed?

It was removed because `org-element-paragraph-separate' is not enough to
find the boundaries of a paragraph, e.g.,

  - item1
  - item2
  This is a new paragraph

It is usually not a problem except for `fill-region', as you noticed.
However, I do not know how to plug our own functions into `fill-region'.

We could replace `fill-region' with `org-fill-region', tho.


Regards,

--
Nicolas Goaziou