From mboxrd@z Thu Jan 1 00:00:00 1970 From: Henning Redestig Subject: Re: org babel before excute hook Date: Mon, 14 Oct 2013 08:45:28 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8ff24d9d4e146f04e8add09e Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVbuE-0002Fc-TN for emacs-orgmode@gnu.org; Mon, 14 Oct 2013 02:45:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVbuD-0005bd-JD for emacs-orgmode@gnu.org; Mon, 14 Oct 2013 02:45:30 -0400 Received: from mail-ie0-x22e.google.com ([2607:f8b0:4001:c03::22e]:60802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVbuD-0005bX-8v for emacs-orgmode@gnu.org; Mon, 14 Oct 2013 02:45:29 -0400 Received: by mail-ie0-f174.google.com with SMTP id qd12so7232481ieb.5 for ; Sun, 13 Oct 2013 23:45:28 -0700 (PDT) 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: emacs-orgmode@gnu.org Cc: John Kitchin --e89a8ff24d9d4e146f04e8add09e Content-Type: text/plain; charset=ISO-8859-1 if anyone is interested in this, a simple defadvice appears to be a good option, I put (defadvice org-babel-execute-maybe (around org-babel-stop-on-collision) "stop execution of result file defined more than once" (let ((info (org-babel-get-src-block-info))) (setq result-file (cdr (assoc :file (nth 2 info)))) (if (save-excursion (goto-char 0) (re-search-forward (concat ":file +" result-file) nil t) (re-search-forward (concat ":file +" result-file) nil t)) (error (concat result-file " defined in more than one source block")) ad-do-it))) (ad-activate 'org-babel-execute-maybe) in my .emacs and appear to get the desired functionality 2013/10/13 Samuel Wales > In case it helps, there is org-confirm-babel-evaluate. > > (But I have not found it to be useful, because it does not seem to > place point in a place where you can check properties, etc.) > > Samuel > > -- > The Kafka Pandemic: http://thekafkapandemic.blogspot.com > > The disease DOES progress. MANY people have died from it. ANYBODY can > get it. > > Denmark: free Karina Hansen NOW. > --e89a8ff24d9d4e146f04e8add09e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
if anyone is interested in this, a simple defadvice a= ppears to be a good option, I put

(defadvice org-babel-execute-mayb= e (around org-babel-stop-on-collision)
=A0 "stop execution of resul= t file defined more than once"
=A0 (let ((info (org-babel-get-src-block-info)))
=A0=A0=A0 (setq result-= file (cdr (assoc :file (nth 2 info))))
=A0=A0=A0 (if (save-excursion
= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (goto-char 0)
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (r= e-search-forward (concat ":file +" result-file) nil t)
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (re-search-forward (concat ":file +" = result-file) nil t))
=A0=A0=A0=A0=A0=A0=A0 (error (concat result-file &q= uot; defined in more than one source block"))
=A0=A0=A0=A0=A0 ad-do= -it)))
(ad-activate 'org-babel-execute-maybe)


in my .emacs and appear to get the desired functionality
<= div>



2013/10/13 Samuel Wales <samologist@gmail.com>=
In case it helps, there is org-confirm-babel= -evaluate.

(But I have not found it to be useful, because it does not seem to
place point in a place where you can check properties, etc.)

Samuel

--
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress. =A0MANY people have died from it. =A0ANYBODY can= get it.

Denmark: free Karina Hansen NOW.

--e89a8ff24d9d4e146f04e8add09e--