On Tue, Jan 10, 2017 at 7:34 PM, Matt Price <mopto...@gmail.com> wrote:

>
>
> On Tue, Jan 10, 2017 at 6:58 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
> wrote:
>
>> Hello,
>>
>> Matt Price <mopto...@gmail.com> writes:
>>
>> > What's going on here? Can anyone else reproduce this? I'm seeing it on
>> org
>> > 9.0.3 up to date as of today, emacs git from 2017-01-04.
>>
>> You mark a region then jump around the buffer with `org-map-entries'. At
>> some point the region contains no headline, but you request a subtree
>> export, hence the error.
>>
>
> But what about the weird export results, where files don't seem to contain
> the expected content? And is there a better way (than marking and bouncing)
> to constrain org-map-entries to first-level headings only?
>

Well, I can't answer the first question, about the wierd export results,
but here at least is a better way, using org-element-map:

(defun mwp-org-export-all-to-org ()
  (interactive)
  (org-element-map (org-element-parse-buffer)'headline
    (lambda (headline)
      (let ((begin (org-element-property :begin headline))
            (level (org-element-property :level headline))
            (commentedp (org-element-property :commentedp headline))
            (tags (org-element-property :tags headline)))
        (unless (or (> level 1)
                    commentedp
                    (member "noexport" tags)
                    ;; I would prefer to get the exclude-tags dynamically
but
                    ;; I'm not sure how to do it properly -- need to access
exclude-tags somehow
                    ;; (cl-loop for k in (plist-get options :exclude-tags)
                    ;;          thereis (member k  tags))
                    )
          (save-excursion
            (goto-char begin)
            (org-org-export-to-org nil t )))))))

On Tue, Jan 10, 2017 at 7:34 PM, Matt Price <mopto...@gmail.com> wrote:

>
>
> On Tue, Jan 10, 2017 at 6:58 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
> wrote:
>
>> Hello,
>>
>> Matt Price <mopto...@gmail.com> writes:
>>
>> > What's going on here? Can anyone else reproduce this? I'm seeing it on
>> org
>> > 9.0.3 up to date as of today, emacs git from 2017-01-04.
>>
>> You mark a region then jump around the buffer with `org-map-entries'. At
>> some point the region contains no headline, but you request a subtree
>> export, hence the error.
>>
>
> But what about the weird export results, where files don't seem to contain
> the expected content? And is there a better way (than marking and bouncing)
> to constrain org-map-entries to first-level headings only?
>

Reply via email to