From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: getting file properties Date: Sun, 05 May 2013 00:36:04 -0400 Message-ID: <87vc6ym4az.fsf@pierrot.dokosmarshall.org> References: <878v3utcs5.fsf@adboyd.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYqgM-00060X-IC for emacs-orgmode@gnu.org; Sun, 05 May 2013 00:36:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYqgJ-0000i4-Kr for emacs-orgmode@gnu.org; Sun, 05 May 2013 00:36:18 -0400 Received: from plane.gmane.org ([80.91.229.3]:47303) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYqgJ-0000ho-Db for emacs-orgmode@gnu.org; Sun, 05 May 2013 00:36:15 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UYqgI-0001Sn-NM for emacs-orgmode@gnu.org; Sun, 05 May 2013 06:36:14 +0200 Received: from pool-108-7-96-134.bstnma.fios.verizon.net ([108.7.96.134]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 05 May 2013 06:36:14 +0200 Received: from ndokos by pool-108-7-96-134.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 05 May 2013 06:36:14 +0200 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: emacs-orgmode@gnu.org david@adboyd.com (J. David Boyd) writes: > John Kitchin writes: > >> Hi everyone, >> >> if I have an org-file with this in it: >> >> #+EMAIL: jkitchin@cmu.edu >> >> is there an org lisp command to get the email address after I have >> opened the file? I am looping through many files to generate a report, >> and would like to do this in emacs-lisp. I had hoped org-entry-get >> would do it, but it does not (it will retrieve it from #+PROPERTY: >> EMAIL jkitchin@cmu.edu). >> >> Is it possible to define other keywords similar to that? E.g. >> >> #+ANDREWID: jkitchin >> >> and then to be able to read them from a lisp command (without writing >> the parsing code myself)? something like (org-entry-get-keyword >> "ANDREWID"). >> >> I could not find anything like this in the property API >> (http://orgmode.org/manual/Using-the-property-API.html) which is where >> i thought it would be. >> >> Thanks! >> >> John >> >> ----------------------------------- >> John Kitchin >> Associate Professor >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> http://kitchingroup.cheme.cmu.edu > > > I'm interested in an answer to this as well... > > > Here's one way: --8<---------------cut here---------------start------------->8--- (defun jk-org-kwds () (let* ((parse-tree (org-element-parse-buffer)) (keys (org-element-map parse-tree 'keyword (function identity)))) (mapcar (function (lambda (x) (cons (org-element-property :key x) (org-element-property :value x)))) keys))) --8<---------------cut here---------------end--------------->8--- This returns a list of (KEY. VALUE) pairs. I'm sure there are other (better, cheaper) ways, but I'm going through org-element.el, and having that hammer in hand, everything looks like a nail to me :-) -- Nick