emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] strange results with org-map-entries


From: Matt Price
Subject: Re: [O] strange results with org-map-entries
Date: Wed, 11 Jan 2017 09:01:47 -0500



On Tue, Jan 10, 2017 at 7:34 PM, Matt Price <address@hidden> wrote:


On Tue, Jan 10, 2017 at 6:58 PM, Nicolas Goaziou <address@hidden> wrote:
Hello,

Matt Price <address@hidden> 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 <address@hidden> wrote:


On Tue, Jan 10, 2017 at 6:58 PM, Nicolas Goaziou <address@hidden> wrote:
Hello,

Matt Price <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]