From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Multiple (identical) RESULTS blocks of one code block? Date: Tue, 10 Mar 2015 10:06:04 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVG79-0001iK-Ru for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 05:06:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVG75-0006d1-LR for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 05:06:11 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:39125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVG75-0006ct-FC for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 05:06:07 -0400 Received: by wiwl15 with SMTP id l15so28254870wiw.4 for ; Tue, 10 Mar 2015 02:06:06 -0700 (PDT) In-Reply-To: (John Kitchin's message of "Mon, 09 Mar 2015 09:01:40 -0400") 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: John Kitchin Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable John Kitchin writes: > I don't believe this is possible out of the box. The first RESULTS block > from the beginning of the buffer will be updated, and not the others. > > You might be able to use a hook function to do this, something like: > > #+BEGIN_SRC emacs-lisp > (defun update-results () (interactive) > ;; get name of src block > (let ((name (org-element-property :name (org-element-at-point))) > (results)) > (when name > (org-element-map (org-element-parse-buffer) 'fixed-width > (lambda (object) > (if results > ;; replace value in block > (setf > (buffer-substring > (org-element-property :begin object) > (org-element-property :end object)) > results) > ;; set results > (setq results > (buffer-substring > (org-element-property :begin object) > (org-element-property :end object))))))))) > #+END_SRC > #+BEGIN_SRC emacs-lisp > (add-hook 'org-babel-after-execute-hook 'update-results) > #+END_SRC > > This worked on a small test example, but I did not test it > thoroughly. your mileage might vary ;) This looks nice - I will try it out and see how it goes. > > > Rainer M Krug writes: > >> Hi >> >> Consider the following: >> >> --8<---------------cut here---------------start------------->8--- >> * The calculation >> #+NAME: testcode :exports both >> #+begin_src R :session test >> runif(10) >> #+end_src >> >> >> * summary of the results >> First time >> #+RESULTS: testcode :exports both >> | 0.772744940361008 | >> | 0.170518629485741 | >> | 0.0833237133920193 | >> | 0.149035625392571 | >> | 0.698798568220809 | >> | 0.627075897762552 | >> | 0.177144371205941 | >> | 0.0476319056469947 | >> | 0.289851602632552 | >> | 0.0296813279855996 | >> >> * and another >> testthingy >> #+RESULTS: testcode :exports both >> >> --8<---------------cut here---------------end--------------->8--- >> >> If I update the calculation, the first results block is updated, but >> not the second one. I would like to have two RESULTS blocks which >> are both updated when the code block is evaluated. >> >> Is this possible? >> >> Thanks, >> >> Rainer > > -- > 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 > > =2D-=20 Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJU/rP9AAoJENvXNx4PUvmC1H8H/1j9lbd/bsc0NVzUZCR8eOXe SS+WJjvrZjYLXyKGbgXmebQvrWtFjRVs7TKVsFtUIZFj4YnQxsmdSW/qirSKmtGS tCrRtmXxzg8YCCJVtepTxwzu6v9apyCaL8RtDJqMwC6YstR5QErEbS4pVBi0CvzT UB85SPMVDYn+wVm2rZjqnsQEpAqjJQaue7hmg3WRDuRHStltwDvnRBkBi9GQ/03A pspTPWo3BThNFbyGFrat7hpmyH58nA+WnWaCmtyxI4aOeowiujOml0bi3Sk7nigS 6o5ItDhjMRT+5soDMWxEoxkAdWLqh6jwABMoVb9Yu+2mfHJK1cdMo6uUaWKdYwk= =QYjF -----END PGP SIGNATURE----- --=-=-=--