[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] org-element-property syntax (turning strings into keyword symbol
From: |
Nicolas Goaziou |
Subject: |
Re: [O] org-element-property syntax (turning strings into keyword symbols) |
Date: |
Sat, 09 Nov 2013 08:48:15 +0100 |
Hello,
Matt Price <address@hidden> writes:
> 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
Then `upcase' the property name first. I assume you will only refer to
user-defined properties so their equivalent keyword will always be in
upper cases.
> (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?
Use `intern'.
For efficiency reasons, I also suggest to store `org-element-at-point'
in a variable instead of computing it again each time you are looking
for a property:
(let ((hashprops nil)
(element (org-element-at-point)))
(dolist (prop org-writers-room-properties)
(if (org-element-property (intern (concat ":" (upcase prop))) element)
...)))
Regards,
--
Nicolas Goaziou