From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: org-forward-paragraph doesn't work programatically (called from Lisp) Date: Sun, 07 Oct 2018 19:14:56 -0400 Message-ID: <87zhvps61b.fsf@kyleam.com> References: <878t394rwr.fsf@tu-berlin.de> <87tvlxo8m6.fsf@nicolasgoaziou.fr> <87bm854i4k.fsf@tu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9IVM-00086h-8M for emacs-orgmode@gnu.org; Sun, 07 Oct 2018 19:30:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9IGN-00004u-U2 for emacs-orgmode@gnu.org; Sun, 07 Oct 2018 19:15:09 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:57153) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9IGN-0008Vc-Kj for emacs-orgmode@gnu.org; Sun, 07 Oct 2018 19:15:03 -0400 In-Reply-To: <87bm854i4k.fsf@tu-berlin.de> 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: wildgruber@tu-berlin.de, Nicolas Goaziou Cc: i@nickey.ru, emacs-orgmode@gnu.org Gerald Wildgruber writes: [...] > Yet, I can't get any result: upon evaluating the "let" in the scratch > buffer, I just get "nil" in the echo area, and nothing else has > happened, none of the files in the directory is touched. > > @Nikolay: can you confirm that this worked for you? I can confirm that it worked on my end. But... > Same thing with a single file: > > (let ((fill-column most-positive-fixnum)) > (dolist (f (list "~/lorem.org")) > (with-current-buffer (find-file-noselect f) > (while (not (eobp)) > (fill-paragraph) > (org-forward-paragraph)) > (save-buffer)))) here are two ways I could make the above code fail: 1) If the buffer for the file is already open and point is after the text. It seems your code should call `(goto-char (point-min))' and, if you care, restore it afterwards. 2) Your code doesn't account for hidden text in the buffer. You could call `(org-show-all)'. I suspect #2 is why you're not seeing the results you expect. -- Kyle