From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [BABEL] "unset" :var definitions for subtree Date: Fri, 11 Feb 2011 13:49:12 +0000 Message-ID: References: <4D500BEC.1080300@gmail.com> <87bp2koeir.fsf@gmail.com> <4D53A2D2.2080300@gmail.com> <87r5bfn8dg.fsf@gmail.com> <4D54FAA0.3040309@gmail.com> <4D550DCB.3070305@gmail.com> <4D552BC6.7070400@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=45038 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PntNA-0002is-2d for emacs-orgmode@gnu.org; Fri, 11 Feb 2011 08:49:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PntN8-00045d-F8 for emacs-orgmode@gnu.org; Fri, 11 Feb 2011 08:49:19 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:43907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PntN8-000456-7H for emacs-orgmode@gnu.org; Fri, 11 Feb 2011 08:49:18 -0500 Received: by wwb17 with SMTP id 17so2549838wwb.30 for ; Fri, 11 Feb 2011 05:49:17 -0800 (PST) In-Reply-To: <4D552BC6.7070400@gmail.com> (Rainer M. Krug's message of "Fri, 11 Feb 2011 13:29:58 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rainer M Krug Cc: emacs-orgmode [...] >> 2. It should be possible somehow to include the options together with >> the shebang, or to replace :shebang with a more general "preamble" >> concept. Or to make :shebang accept a code block as its value. >> >> -------------------------------------------- >> #+BABEL: :var A=13 >> #+BABEL: :var B=14 >> >> #+header: :shebang #!/bin/bash #$ -cwd >> #+begin_src sh :tangle script.sh >> # empty >> #+end_src >> -------------------------------------------- > > Similar to above - should work, but now the options for torque are > hidden in the shebang - which is not to nice, but should work - although > changing the options is not nearly as nice as if the options are in the > source block. It seems that we should be able to put the preamble lines in a src block. This works, but only after making an alteration to the sbe function (below) so that it will allow multiple line results. Maybe Eric will have some ideas here. --------------------------------------- #+BABEL: :var A=13 #+BABEL: :var B=14 #+srcname: sheb #+begin_src sh :results output echo '#!/bin/bash' echo '#$ -cwd' #+end_src #+header: :shebang (sbe sheb) #+begin_src sh :tangle script.sh # empty #+end_src --------------------------------------- (setq source-block (symbol-name source-block))) - (org-babel-table-truncate-at-newline ;; org-table cells can't be multi-line (if (and source-block (> (length source-block) 0)) (let ((params (eval `(org-babel-parse-header-arguments @@ -116,7 +115,7 @@ example above." ")"))))) (org-babel-execute-src-block nil (list "emacs-lisp" "results" params) '((:results . "silent")))) - "")))) + ""))) Dan