[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] org-forward-paragraph doesn't work programatically (called from
From: |
Kyle Meyer |
Subject: |
Re: [O] org-forward-paragraph doesn't work programatically (called from Lisp) |
Date: |
Sun, 07 Oct 2018 19:14:56 -0400 |
Gerald Wildgruber <address@hidden> 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