emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: How to identify all headings that won't be exported?
Date: Thu, 26 Jun 2014 14:40:01 -1000	[thread overview]
Message-ID: <m24mz7b2xq.fsf@tsdye.com> (raw)
In-Reply-To: <m2k383o5c7.fsf@tsdye.com> (Thomas S. Dye's message of "Thu, 26 Jun 2014 09:09:44 -1000")

Aloha all,

Answering myself ...

tsd@tsdye.com (Thomas S. Dye) writes:

> Is there a practical way to identify descendants for my use
> case? 
>
>   (defun tsd-get-names-labels-and-headings ()
>     (interactive)
>     (save-excursion
>       (goto-char (point-min))
>       (let ((matches))
>         (while
>             (re-search-forward "\\#\\+\\(name\\|label\\):\\s-\\(.*\\)" (point-max) t)
>           (add-to-list 'matches (match-string-no-properties 2) t))
>         (dolist (heading (org-map-entries 'org-heading-components))
>           (when (and (nth 4 heading) (not (search "noexport"(nth 5 heading))))
>             (add-to-list 'matches (nth 4 heading))))
>         (dolist (properties (org-map-entries 'org-entry-properties))
>           (when (cdr (assoc "CUSTOM_ID" properties))
>             (add-to-list 'matches
>                          (format "#%s" (cdr (assoc "CUSTOM_ID" properties))))))
>         (sort matches 'string<))))

Yes, use the MATCH argument to org-map-entries.

Many thanks to Jonathan Leech-Pepin for pointing this out to me off
list.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

  reply	other threads:[~2014-06-27  0:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 19:09 How to identify all headings that won't be exported? Thomas S. Dye
2014-06-27  0:40 ` Thomas S. Dye [this message]
     [not found] ` <CAEWDx5f+MgsCFFw9h9hoPT_HcKstt4WG6s+FZKRzEEH3G1So_A@mail.gmail.com>
2014-06-27  0:59   ` Fwd: " Jonathan Leech-Pepin

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=m24mz7b2xq.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    /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).