emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: strange results with org-map-entries
Date: Wed, 11 Jan 2017 09:01:47 -0500	[thread overview]
Message-ID: <CAN_Dec_n=NcNhEe0PvSvKwxwSjFSw9HTc+2xrHJT4n4-ybpqLw@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec--gknN9xCuU0eWxLR+sYcqwhD8wN4xM6tsg6Ce6UiYVA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]

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

>
>
> On Tue, Jan 10, 2017 at 6:58 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
>
>> Hello,
>>
>> Matt Price <moptop99@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 <moptop99@gmail.com> wrote:

>
>
> On Tue, Jan 10, 2017 at 6:58 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
>
>> Hello,
>>
>> Matt Price <moptop99@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?
>

[-- Attachment #2: Type: text/html, Size: 4442 bytes --]

      reply	other threads:[~2017-01-11 14:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 18:06 strange results with org-map-entries Matt Price
2017-01-10 23:58 ` Nicolas Goaziou
2017-01-11  0:34   ` Matt Price
2017-01-11 14:01     ` Matt Price [this message]

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='CAN_Dec_n=NcNhEe0PvSvKwxwSjFSw9HTc+2xrHJT4n4-ybpqLw@mail.gmail.com' \
    --to=moptop99@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --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).