From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: org-element-property syntax (turning strings into keyword symbols) Date: Sat, 9 Nov 2013 01:29:40 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vf23C-0006WS-Tj for emacs-orgmode@gnu.org; Sat, 09 Nov 2013 01:29:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vf23B-0008Jt-Ue for emacs-orgmode@gnu.org; Sat, 09 Nov 2013 01:29:42 -0500 Received: from mail-qa0-x231.google.com ([2607:f8b0:400d:c00::231]:42165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vf23B-0008Jn-Q2 for emacs-orgmode@gnu.org; Sat, 09 Nov 2013 01:29:41 -0500 Received: by mail-qa0-f49.google.com with SMTP id cm18so324364qab.15 for ; Fri, 08 Nov 2013 22:29:40 -0800 (PST) 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 Hi, I'm trying to write a query that will check to see if the current element has any of several properties set; the properties are defined in a defcustom so I don't know in advance which properties I'm interested in. So I have the following code which INSERTS properties: (defcustom org-writers-room-properties '(("Synopsis" . "Put a short summary here") ("Role in Book" . "Describe what you want this section to accomplish") ("Characters" . "who is in this section")) "alist of properties to be inserted automatically on heading creation" :group 'org-writers-room :type 'alist) (defun org-wr-main-heading-hook () "Adds a properties drawer & populates it with several properties. Intended to be used with org-insert-heading-hook, but is also interactive." (interactive) (save-excursion (dolist (this-property org-writers-room-properties) (org-set-property (car this-property) (cdr this-property)) ) (org-flag-drawer 'nil) (select-window (window-with-name "guide")) (org-cycle-hide-drawers 'all) ) ) This works fine. Now when I come back to this buffer I want to check whether any of the properties are actually there. So I am trying something like this: (let ((hasprops nil)) (dolist prop org-writers-room-properties (if (org-element-property (car prop) (org-element-at-point)) (setq hasprops t)) (if (hasprops) (etc.)) However this doesn't work because (1) the car of "prop" (which is in fact the property name) is not necessarily capitalized and (2) the "property" parameter of org-element-property is not a string, but a "keyword symbol". Somehow I have to turn my string into the appropriate keyword symbol. Does anyone know how to do this? Thank you! Matt