Bastien <b...@gnu.org> writes: > Hi Alan, > > Alan Schmitt <alan.schm...@polytechnique.org> writes: > >> Do you have tools or an approach using emacs (as a command line tool) to >> suggest? > > I would call emacs in batch mode, applying some Elisp code to fill > each element. See `org-forward-element' and `org-fill-paragraph'.
Thanks a lot for the suggestion, it works. I did not use `org-forward-element' as it does not iterate on sub-items. I simply do a `forward-line' to go done. Here is the code, if it's helpful to others. --8<---------------cut here---------------start------------->8--- #!/usr/local/bin/emacs --script ;;-*- mode: emacs-lisp;-*- ;; Found at http://superuser.com/a/487329/155265 from question ;; https://superuser.com/questions/31404/how-to-make-emacs-read-buffer-from-stdin-on-start (require 'org) (with-temp-buffer (progn ; read the file in the temporary buffer ; do not add a \n at the end (condition-case nil (let ((line (read-from-minibuffer ""))) (insert line) (while (setq line (read-from-minibuffer "")) (insert "\n") (insert line))) (error nil)) ; do what you want here (goto-char (point-min)) (while (< (point) (point-max)) (org-fill-paragraph) (forward-line)) (princ (buffer-string)))) --8<---------------cut here---------------end--------------->8--- Thanks again, Alan