emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <Rainer@krugs.de>
To: emacs-orgmode@gnu.org
Subject: [babel] Feature request - WAS: org babel before excute hook
Date: Mon, 14 Oct 2013 10:11:54 +0200	[thread overview]
Message-ID: <m2mwmcjmph.fsf_-_@krugs.de> (raw)
In-Reply-To: CAO8D54wuHOPJhj-dt+BVZSwTOwQSsE-U_WmH724orOeo6Lmj8g@mail.gmail.com

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 <henning.red@gmail.com> 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 <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.  MANY people have died from it.  ANYBODY can
>> get it.
>>
>> Denmark: free Karina Hansen NOW.
>>
<#secure method=pgpmime mode=sign>

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

  reply	other threads:[~2013-10-14  8:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 13:56 org babel before excute hook Henning Redestig
2013-10-11 20:31 ` John Kitchin
2013-10-12  2:28   ` Charles Berry
2013-10-12 13:11     ` Henning Redestig
2013-10-13 21:22     ` Henning Redestig
2013-10-13 21:35       ` Samuel Wales
2013-10-14  6:45         ` Henning Redestig
2013-10-14  8:11           ` Rainer M Krug [this message]
2013-10-14 13:24         ` Eric Schulte
2013-10-26 22:05           ` Samuel Wales
2013-10-14 13:29       ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2mwmcjmph.fsf_-_@krugs.de \
    --to=rainer@krugs.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).