From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: How to identify all headings that won't be exported? Date: Thu, 26 Jun 2014 09:09:44 -1000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0F3c-0005Jg-Mv for emacs-orgmode@gnu.org; Thu, 26 Jun 2014 15:10:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0F3U-0002wj-AY for emacs-orgmode@gnu.org; Thu, 26 Jun 2014 15:10:04 -0400 Received: from gproxy4-pub.mail.unifiedlayer.com ([69.89.23.142]:39625) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1X0F3T-0002wf-Ta for emacs-orgmode@gnu.org; Thu, 26 Jun 2014 15:09:56 -0400 Received: from [72.253.173.33] (port=50196 helo=manifi) by box472.bluehost.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82) (envelope-from ) id 1X0F3M-0002Fr-F9 for emacs-orgmode@gnu.org; Thu, 26 Jun 2014 13:09:48 -0600 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, Inspired by John Kitchin's org-ref, I'm working on a little function that returns all the pieces of an Org mode file that are candidates for cross referencing. The helm package lets me choose from among the candidates and then another little function inserts the chosen link. This all works for me, and I'm finding it really useful. The only slight problem is that I haven't been able to figure out how to eliminate all the headings that won't be exported. You'll see in the code below that my simple-minded approach gets all the headings tagged :noexport:, but it doesn't understand that the tag is inherited by descendants. 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<)))) All the best, Tom -- Thomas S. Dye http://www.tsdye.com