From: Gerald Wildgruber <wildgruber@tu-berlin.de>
To: Kyle Meyer <kyle@kyleam.com>
Cc: i@nickey.ru, emacs-orgmode@gnu.org,
Nicolas Goaziou <mail@nicolasgoaziou.fr>
Subject: Re: org-forward-paragraph doesn't work programatically (called from Lisp)
Date: Mon, 8 Oct 2018 07:32:02 +0200 [thread overview]
Message-ID: <874ldxovfx.fsf@tu-berlin.de> (raw)
In-Reply-To: <87zhvps61b.fsf@kyleam.com>
On Mo, Okt 08 2018, Kyle Meyer <kyle@kyleam.com> wrote:
> 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.
Wow, thanks a lot Kylie, this was it! I never thought of having to unfold the Org mode entries in a buffer when opening in a non interactive way.
I do this now from a lisp buffer and both functions work exactly as expected:
single file:
============
(let ((fill-column most-positive-fixnum))
(dolist (f (list "~/lorem.org"))
(with-current-buffer (find-file-noselect f)
(org-show-all)
(while (not (eobp))
;; (mark-whole-buffer)
(fill-paragraph)
(org-forward-paragraph))
(save-buffer))))
recursively through dir tree:
=============================
(let ((fill-column most-positive-fixnum))
(dolist (f (directory-files-recursively
"/dirs/with/org/files/" (rx (or ".org" ".outl") eos)))
(with-current-buffer (find-file-noselect f)
(org-show-all)
(while (not (eobp))
(fill-paragraph)
(org-forward-paragraph))
(save-buffer))))
That's great; I'm glad it works now from within emacs itself (and not via sed, awk or tr as I tried before), harnessing all the knowledge the editor has of its own constructs, especially with some of the more complicated list and enumeration structures, -- all of them are correctly unfilled now.
Thanks again
Gerald.
--
Sent with mu4e
prev parent reply other threads:[~2018-10-08 5:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-07 16:56 org-forward-paragraph doesn't work programatically (called from Lisp) Gerald Wildgruber
2018-10-07 19:32 ` Nicolas Goaziou
2018-10-07 20:27 ` Gerald Wildgruber
2018-10-07 23:14 ` Kyle Meyer
2018-10-08 5:32 ` Gerald Wildgruber [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874ldxovfx.fsf@tu-berlin.de \
--to=wildgruber@tu-berlin.de \
--cc=emacs-orgmode@gnu.org \
--cc=i@nickey.ru \
--cc=kyle@kyleam.com \
--cc=mail@nicolasgoaziou.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).