From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: adding attributes to tables in results Date: Sat, 21 Nov 2015 16:45:50 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0Fym-0004JB-O2 for emacs-orgmode@gnu.org; Sat, 21 Nov 2015 16:45:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0Fyj-0007RU-GM for emacs-orgmode@gnu.org; Sat, 21 Nov 2015 16:45:56 -0500 Received: from mail-qg0-x232.google.com ([2607:f8b0:400d:c04::232]:34702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0Fyj-0007RQ-Bl for emacs-orgmode@gnu.org; Sat, 21 Nov 2015 16:45:53 -0500 Received: by qgeb1 with SMTP id b1so94653473qge.1 for ; Sat, 21 Nov 2015 13:45:53 -0800 (PST) In-reply-to: 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: "Charles C. Berry" Cc: org-mode mailing list , Vikas Rawal Also an interesting approach! I never execute src blocks on export though (old habit of having expensive blocks, and the desire to know what the export looks like). This is close to what I want: #+name: el_attr #+BEGIN_SRC emacs-lisp :var data='(1 2 3) (org-babel-format-result (concat "#+tblname: test\n" "#+ATTR_LATEX: :environment longtable\n" (orgtbl-to-generic (list data) (list :lstart "|" :lend "|" :sep "|" :fmt "%s")))) #+END_SRC #+RESULTS: el_attr : #+tblname: test : |1|2|3| #+BEGIN_SRC emacs-lisp :exports results :post el_attr(*this*) (list (+ 1 2) 3 3) #+END_SRC #+RESULTS: : #+tblname: test : #+ATTR_LATEX: :environment longtable : |3|3|3| But I cannot figure out how to get the results in org format. If I put :results org or raw in I get this output: #+RESULTS: #+tblname: test #+ATTR_LATEX: :environment longtable |40|51|32|51|32|51|41| Charles C. Berry writes: > On Sat, 21 Nov 2015, John Kitchin wrote: > >> I am running a search committee of 5 people. As applications come in, an >> org heading is created for each application, and I run a command to send >> one of the committee an email with a review rubric in it, and this >> command creates a subheading to put their review. We have 275 >> applications so far, so I am using code to aggregate results into tables. > > Ouch! That is serious work! > > [snip] >> >> The tip Charles gave works for export, but the tables do not look too >> good for me in the org-document unless I run C-c ' on them to get them >> in org, and I also want them functional in the org-buffer too. >> >> > > Use a different wrapper for executing src block outside of exports. > > Something like this (with suitable tuning) should work: > > #+BEGIN_SRC emacs-lisp > (defun ex-aware-wrap () > (if org-export-current-backend > (concat "src org :exports results " > ":results replace " > "\n#+ATTR_LATEX: " > ":environment longtable") > "example")) > #+END_SRC > > #+BEGIN_SRC emacs-lisp :exports results :wrap (ex-aware-wrap) > (list (+ 1 2) 3 4) > #+END_SRC > > HTH, > > Chuck -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu