From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: [babel] Feature request - WAS: org babel before excute hook Date: Mon, 14 Oct 2013 10:11:54 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVdG9-00061D-9p for emacs-orgmode@gnu.org; Mon, 14 Oct 2013 04:12:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVdG2-0005AQ-MO for emacs-orgmode@gnu.org; Mon, 14 Oct 2013 04:12:13 -0400 Received: from plane.gmane.org ([80.91.229.3]:45613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVdG2-0005AH-CJ for emacs-orgmode@gnu.org; Mon, 14 Oct 2013 04:12:06 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VVdG0-0007mZ-Du for emacs-orgmode@gnu.org; Mon, 14 Oct 2013 10:12:04 +0200 Received: from arn78-1-88-186-171-7.fbx.proxad.net ([88.186.171.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 Oct 2013 10:12:04 +0200 Received: from Rainer by arn78-1-88-186-171-7.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 Oct 2013 10:12:04 +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 At the moment, I have the feeling that there is no solution to the actual problem (avoiding duplicate :file names) without doctoring in an unsatisfying (and potentially fragile?) way. I would therefore formulate a feature request: It is a common error to accidentally use the same :file name and to have consequently the wrong file in the exported file. I would therefore suggest a property with the following possible values: ,---- | file_unique | | - false :: the actual behaviour, i.e. consequtive :file overwrite the | original ones *without* warning | - true :: if more then one :file exist, an consecutive number is automatically | to the :file and cached to avoid having leftover files (as in temp files) | - warn :: give a warning on export, so that this error can be fixed | manually. `---- I would see this as a valuable addition to the export feature as it avoids errors. Cheers, Rainer Henning Redestig writes: > 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. >> <#secure method=pgpmime mode=sign> -- Rainer M. Krug email: RMKruggmailcom