emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Leo Alekseyev <dnquark@gmail.com>
Cc: Andreas Leha <andreas.leha@med.uni-goettingen.de>, emacs-orgmode@gnu.org
Subject: Re: Is it possible to run shell script src blocks as root or to export individual blocks?
Date: Mon, 19 Mar 2012 10:46:04 -0400	[thread overview]
Message-ID: <87fwd4abtf.fsf@gmx.com> (raw)
In-Reply-To: <CADzxs1ktWrC8t3LxonWh78Xhq889MM_wTXYi4j_D9tvk+OkbTw@mail.gmail.com> (Leo Alekseyev's message of "Mon, 19 Mar 2012 04:42:14 -0400")

[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]

Leo Alekseyev <dnquark@gmail.com> writes:

> On Mon, Mar 5, 2012 at 10:24 AM, Eric Schulte <eric.schulte@gmx.com> wrote:
>> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>>
>>> Eric Schulte <eric.schulte@gmx.com> writes:
>>>
>>>> Leo Alekseyev <dnquark@gmail.com> writes:
>>>>
>>>>> I was wondering if there was an easy way to execute some shell
>>>>> commands contained in a src block as root.  Alternatively, is there a
>>>>> quick way to export _just_ that one source block to a temp file so
>>>>> that I could run it as root manually?
>>>>>
>>>>
>>>> Just call org-babel-tangle with a prefix argument and it only tangles
>>>> the current block
>
> Hi all,
>
> I just pulled a fresh version of org, and this tangling an individual
> block only works if there's a :tangle header argument present.  I
> don't think this is the intended behavior!  The problem, it seems, is
> that when :tangle is not present, the (or ...) in the code below
> always evaluates to true.
>
> #+begin_src emacs-lisp
>       (unless (or (cdr (assoc :tangle (nth 2 (org-babel-get-src-block-info))))
> 		  target-file)
> 	(setq target-file
> 	      (read-from-minibuffer "Tangle to: " (buffer-file-name)))))
> #+end_src

Thanks for raising this issue.  I can not apply patches to the git
repository until the recent git issues are sorted, so I am attaching the
patch to this email so that you can apply it locally if you like.  I
will push this up once our git repository is back in working order.

Best,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-Bring-back-prompt-for-single-block-tangling.patch --]
[-- Type: text/x-patch, Size: 1033 bytes --]

From bfacabb33acb4d2dbcfd87b10e3488e43cf5d84a Mon Sep 17 00:00:00 2001
From: Eric Schulte <eric.schulte@gmx.com>
Date: Mon, 19 Mar 2012 10:44:43 -0400
Subject: [PATCH 2/2] Bring back prompt for single-block tangling.

* lisp/ob-tangle.el (org-babel-tangle): Bring back prompt for
  single-block tangling.
---
 lisp/ob-tangle.el |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 5e498ab..b57d89d 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -186,7 +186,10 @@ exported source code blocks by language."
     (unless (org-babel-where-is-src-block-head)
       (error "Point is not currently inside of a code block"))
     (save-match-data
-      (unless (or (cdr (assoc :tangle (nth 2 (org-babel-get-src-block-info))))
+      (unless (or (not (string=
+			(cdr (assoc :tangle
+				    (nth 2 (org-babel-get-src-block-info))))
+			"no"))
 		  target-file)
 	(setq target-file
 	      (read-from-minibuffer "Tangle to: " (buffer-file-name)))))
-- 
1.7.9.4


[-- Attachment #3: Type: text/plain, Size: 48 bytes --]



-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2012-03-19 14:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-03  4:40 Is it possible to run shell script src blocks as root or to export individual blocks? Leo Alekseyev
2012-03-03  8:55 ` Nick Dokos
2012-03-03  9:19 ` org-babel-execute-src-block deletes its src block Daimrod
2012-03-03  9:42   ` Nick Dokos
2012-03-03  9:54     ` Daimrod
2012-03-03 14:46     ` Eric Schulte
2012-03-03 15:11       ` Daimrod
2012-03-03 14:25 ` Is it possible to run shell script src blocks as root or to export individual blocks? Eric Schulte
2012-03-03 16:43   ` Andreas Leha
2012-03-05 15:24     ` Eric Schulte
2012-03-06  9:11       ` Andreas Leha
2012-03-19  8:42       ` Leo Alekseyev
2012-03-19 14:46         ` Eric Schulte [this message]
2012-03-04 17:29 ` Sylvain Rousseau

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=87fwd4abtf.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=dnquark@gmail.com \
    --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).