From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: How to identify all headings that won't be exported? Date: Thu, 26 Jun 2014 14:40:01 -1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0KDF-0005to-SW for emacs-orgmode@gnu.org; Thu, 26 Jun 2014 20:40:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0KD8-0006je-L0 for emacs-orgmode@gnu.org; Thu, 26 Jun 2014 20:40:21 -0400 Received: from gproxy8-pub.mail.unifiedlayer.com ([67.222.33.93]:46034) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1X0KD8-0006jO-Dd for emacs-orgmode@gnu.org; Thu, 26 Jun 2014 20:40:14 -0400 Received: from [72.253.173.33] (port=50480 helo=manifi) by box472.bluehost.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82) (envelope-from ) id 1X0KD0-0007JY-0Z for emacs-orgmode@gnu.org; Thu, 26 Jun 2014 18:40:06 -0600 In-Reply-To: (Thomas S. Dye's message of "Thu, 26 Jun 2014 09:09:44 -1000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org-mode 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