From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-forward-paragraph doesn't work programatically (called from Lisp) Date: Sun, 07 Oct 2018 21:32:49 +0200 Message-ID: <87tvlxo8m6.fsf@nicolasgoaziou.fr> References: <878t394rwr.fsf@tu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9EnQ-0007u0-95 for emacs-orgmode@gnu.org; Sun, 07 Oct 2018 15:32:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9EnN-0002T0-03 for emacs-orgmode@gnu.org; Sun, 07 Oct 2018 15:32:56 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:58171) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9EnM-0002QY-Pt for emacs-orgmode@gnu.org; Sun, 07 Oct 2018 15:32:52 -0400 In-Reply-To: <878t394rwr.fsf@tu-berlin.de> (Gerald Wildgruber's message of "Sun, 7 Oct 2018 18:56:20 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Gerald Wildgruber Cc: emacs-orgmode@gnu.org Hello, Gerald Wildgruber writes: > I'm trying to unfill/unwrap Org mode files because I switched from auto-fill-mode to visual-line/visual-fill-column mode. > > I'd like to harmonize = unfill my already existing (filled) Org mode files. I took the function in > > https://www.emacswiki.org/emacs/UnfillParagraph) > > and tried the following (from within an emacs lisp buffer): > > (let ((fill-column most-positive-fixnum)) > (dolist (f (directory-files-recursively > "~/directory/with/org/files/" (rx (or ".org" ".outl") eos))) > (with-current-buffer (find-file-noselect f) > (while (not (eobp)) > (fill-paragraph) > (org-forward-paragraph)) > (save-buffer)))) > > I thought this would iterate over all paragraphs (or org-wise equivalent structures) until end of file is reached and unfill each one of them. > > But it doesn't work. The iteration doesn't happen, it somehow doesn't move forward. It works though, if called interactively in an Org mode file. > > Why is that, how can I use org-forward-paragraph programmatically? I cannot reproduce your problem. What Org version are you using? Regards, -- Nicolas Goaziou