From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Berry Subject: Re: org babel before excute hook Date: Sat, 12 Oct 2013 02:28:20 +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 ([2001:4830:134:3::10]:37743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUowi-0008Ub-TN for emacs-orgmode@gnu.org; Fri, 11 Oct 2013 22:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUowc-0006Hs-Kk for emacs-orgmode@gnu.org; Fri, 11 Oct 2013 22:28:48 -0400 Received: from plane.gmane.org ([80.91.229.3]:51540) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUowc-0006Hi-Dk for emacs-orgmode@gnu.org; Fri, 11 Oct 2013 22:28:42 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VUowa-0003YS-8Z for emacs-orgmode@gnu.org; Sat, 12 Oct 2013 04:28:40 +0200 Received: from 137.110.34.64 ([137.110.34.64]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 12 Oct 2013 04:28:40 +0200 Received: from ccberry by 137.110.34.64 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 12 Oct 2013 04:28:40 +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 John Kitchin andrew.cmu.edu> writes: > > > > I have a related kind of problem. When preparing notes > for a class, I may end up with 70 code blocks in an org file, many of > which create graphics. I am always worried about accidentally using the > same filename and overwriting a graphic from an earlier block. A unique, > but reproducible filename would be sufficient for my needs. > Header arg values can be elisp calls. You can use `make-temp-file'. So every time this block is executed, a new file is created and the file link is added to the results. #+BEGIN_SRC R :results output append :file (make-temp-file "temp") cat(date(),"\n") #+END_SRC #+RESULTS: [[file:/var/folders/kb/2hchpbyj7lb6z76l0q73w_fh0000gn/T/temp302IjV]] [[file:/var/folders/kb/2hchpbyj7lb6z76l0q73w_fh0000gn/T/temp3028Lu]] See `temporary-file-directory', too, if you want to use this, as the default may not be what you intend. You might want to use this: #+BEGIN_SRC emacs-lisp (defun local-tfile (file) (let ((temporary-file-directory ".")) (make-temp-file file))) #+END_SRC Then the files go in the local directory when this is executed: #+BEGIN_SRC R :file (local-tfile "tfile") :results output append cat(date(),"\n") #+END_SRC You might not want `append' in this case. HTH, Chuck [rest deleted]