emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: wildgruber@tu-berlin.de, 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, 07 Oct 2018 19:14:56 -0400	[thread overview]
Message-ID: <87zhvps61b.fsf@kyleam.com> (raw)
In-Reply-To: <87bm854i4k.fsf@tu-berlin.de>

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

  reply	other threads:[~2018-10-07 23:30 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 [this message]
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=87zhvps61b.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=i@nickey.ru \
    --cc=mail@nicolasgoaziou.fr \
    --cc=wildgruber@tu-berlin.de \
    /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).