emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gerald Wildgruber <wildgruber@tu-berlin.de>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: i@nickey.ru, emacs-orgmode@gnu.org
Subject: Re: org-forward-paragraph doesn't work programatically (called from Lisp)
Date: Sun, 7 Oct 2018 22:27:39 +0200	[thread overview]
Message-ID: <87bm854i4k.fsf@tu-berlin.de> (raw)
In-Reply-To: <87tvlxo8m6.fsf@nicolasgoaziou.fr>


Hi,

I'm using git checkouts for both emacs and Org mode:

Org mode version 9.1.14 (release_9.1.14-921-g13626a)

GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-09-20

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?

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))))

Just "nil" and nothing else.

Thanks

Here's the single file lorem.org I tried to unfill:

==================================================

* Header 1

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
accumsan nisl.

* Header 2

1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Lorem
   ipsum dolor sit amet, consectetuer adipiscing elit.  Curabitur
   vulputate vestibulum lorem.  Praesent augue.  Aenean in sem ac leo
   mollis blandit.  Praesent fermentum tempor tellus.  Nullam libero
   mauris, consequat quis, varius et, dictum id, arcu.  Nulla posuere.
   Mauris mollis tincidunt felis.  Nullam eu ante vel est convallis
   dignissim.  Nullam libero mauris, consequat quis, varius et, dictum
   id, arcu.
2. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Aliquam
   posuere.  Fusce suscipit, wisi nec facilisis facilisis, est dui
   fermentum leo, quis tempor ligula erat quis odio.
3. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Nam a
   sapien.  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
   Vivamus id enim.
4. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Nam a
   sapien.  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
   Vivamus id enim.
5. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Nam a
   sapien.  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
   Vivamus id enim.


* Header 3

- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Nullam
  rutrum.  Vivamus id enim.  Lorem ipsum dolor sit amet, consectetuer
  adipiscing elit.
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Nunc
  eleifend leo vitae magna.
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Nullam
  rutrum.  Donec at pede.  Curabitur vulputate vestibulum lorem.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Nullam
  rutrum.  Donec at pede.  Curabitur vulputate vestibulum lorem.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  Nullam
  rutrum.  Donec at pede.  Curabitur vulputate vestibulum lorem.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.


==================================================



On So, Okt 07 2018, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> Hello,
>
> Gerald Wildgruber <wildgruber@tu-berlin.de> 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,


-- 
Sent with mu4e

  reply	other threads:[~2018-10-07 20:27 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 [this message]
2018-10-07 23:14     ` Kyle Meyer
2018-10-08  5:32       ` Gerald Wildgruber

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=87bm854i4k.fsf@tu-berlin.de \
    --to=wildgruber@tu-berlin.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=i@nickey.ru \
    --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).