From mboxrd@z Thu Jan 1 00:00:00 1970 From: Karl Maihofer Subject: Re: How to export property values of agenda selection? Date: Mon, 8 Apr 2013 09:00:58 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPEXq-0005P9-EN for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 12:03:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPEXl-00012L-FT for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 12:03:46 -0400 Received: from plane.gmane.org ([80.91.229.3]:49634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPEXl-00012C-8D for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 12:03:41 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UPKA0-0003I1-Kl for emacs-orgmode@gnu.org; Tue, 09 Apr 2013 00:03:32 +0200 Received: from ip-62-143-60-131.unitymediagroup.de ([62.143.60.131]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 Apr 2013 00:03:32 +0200 Received: from ignoramus by ip-62-143-60-131.unitymediagroup.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 Apr 2013 00:03:32 +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 Hi Christian, Christian Moe christianmoe.com> writes: > I'm not quite clear on your use case / desired result now. Why do you > want results through batch mode on the command line in order to embed > them in a webpage? Embed how? Is this something you could perhaps do > simply by exporting from Org to HTML? Thanks for your mail. I found a (not so quick but very dirty) way to do what I want. Just to explain: The first step was the management of distribution lists withhin emacs. In the second step I wanted to make the distribution lists also available via Web. What I did now is to use a combination of php, emacs batch mode and agenda views, shellscript and perl: In my index.php I call a shell script: =====================================
emacs-export-distribution-list.sh ================================== # Export Agenda View and write to file emacs -batch -l ~/.emacs -eval '(org-batch-agenda "1")' | sed '1d' | sed '1d' > distribution_list.txt # Extract email adresses perl -wne 'while(/[\w\.]+@[\w\.]+\w+/g){print "$&; "}' distribution_list.txt Emacs configuration ==================== (setq org-agenda-custom-commands (quote (("1" "Distribution List" tags "tag1+tag2" ((org-agenda-prefix-format '((tags . "%-40:(km/get-properties) ; "))) (org-use-tag-inheritance nil)))))) And the function: (defun km/get-properties () (concat (org-entry-get (point) "EMAIL"))) In emacs I could not find a way to extract only the email addresses in an agenda view. So it was a good idea to use the following in the buffer as you suggested: #+NAME: list2csv #+BEGIN_SRC emacs-lisp :var match="tag1+tag2" (mapconcat 'identity (org-map-entries '(org-entry-get (point) "EMAIL") match nil) ",") #+END_SRC But for the webpage I could use Perl to further process an agenda view. And since I knew how to get an agenda view exported using emacs batch mode, this was the hack I was looking for. Perhaps not very professional, but it works. ;-) Thanks again for your help! Karl