From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: cleaning all the #+results from an org document Date: Fri, 29 Jul 2011 10:38:58 -0600 Message-ID: <878vrhnij5.fsf@gmail.com> References: <21734.1311841912@maps> <4E3154FA.5000606@gmail.com> <32216.1311857987@maps> <871uxadk3v.fsf@gmail.com> <80aabx5xyv.fsf@somewhere.org> <804o255wqg.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:40042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmqAv-0001Bv-4u for emacs-orgmode@gnu.org; Fri, 29 Jul 2011 12:44:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QmqAt-0006wc-Hq for emacs-orgmode@gnu.org; Fri, 29 Jul 2011 12:44:37 -0400 Received: from mail-pz0-f49.google.com ([209.85.210.49]:37428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmqAt-0006uH-D4 for emacs-orgmode@gnu.org; Fri, 29 Jul 2011 12:44:35 -0400 Received: by mail-pz0-f49.google.com with SMTP id 33so5717923pzk.8 for ; Fri, 29 Jul 2011 09:44:35 -0700 (PDT) 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: Sebastien Vauban Cc: emacs-orgmode@gnu.org "Sebastien Vauban" writes: > Hi Eric, > > "Sebastien Vauban" wrote: >> Eric Schulte wrote: >>> Ista Zahn writes: >>>> On Thu, Jul 28, 2011 at 8:59 AM, Stephen Eglen >>>> wrote: >>>>> Thanks Torsten, you've expressed it elegantly! >>>>>> >>>>>> c) to delete all the old results and start "fresh" >>>> >>>> +1 for c. I often work with R objects that are simply too large to store >>>> in org tables, so I use babel caching + session + write / load R data >>>> files from disk. This works, but it becomes easy to get to an inconsistent >>>> state, and I would like to be able to delete the results blocks and run >>>> the whole thing fresh. >>> >>> You could try evaluating the following with "M-x :" in an Org-mode buffer. >>> >>> #+begin_src emacs-lisp >>> (org-babel-map-src-blocks nil (org-babel-remove-result)) >>> #+end_src >> >> On the file I took for testing, this works OK. > > More complete test... > > * Test 1 -- OK! > > ** Anonym block > > #+begin_src emacs-lisp :results output org > (print "Test") > #+end_src > > #+results: > #+BEGIN_ORG > > "Test" > #+END_ORG > > ** Named block > > #+source: echo > #+begin_src emacs-lisp :var n="me" > (message "hi %s" n) > #+end_src > > #+results: echo > : hi me > > * Test 2 -- OK! > > Setting a global data through a fake results block: > > #+results: max-lines > : 200 > > Then using it: > > #+source: print-max-lines > #+begin_src emacs-lisp :var n=max-lines > (message "there are %s lines" n) > #+end_src > > #+results: print-max-lines > : there are 200 lines > > The latter results block is deleted. The former, with the assignation, is not. > Excellent! > > * Test 3 -- Not OK... <<< > > And the call line for the named block: > > #+call: echo() > > #+results: echo() > : hi me > > This results block is not deleted, while it should? > Thanks, I've just pushed up a new interactive function `org-babel-kill-results' which deletes code block results, inline code block results, and call line results. > >> Regarding a key binding, looking at =C-c C-v h=, this is already quite full. >> Though, =k= is free, and could be used for "killing the results". > Sounds good to me, the above function is now bound to "C-c C-v k". If called w/o a prefix argument it only applies to the current code block, when called with a prefix argument it applies to the entire buffer. Best -- Eric > > Best regards, > Seb -- Eric Schulte http://cs.unm.edu/~eschulte/