emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [org-babel] References Not Expanding
@ 2010-08-21 21:42 aditya siram
  2010-08-22 21:21 ` [SOLVED] " aditya siram
  0 siblings, 1 reply; 4+ messages in thread
From: aditya siram @ 2010-08-21 21:42 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 643 bytes --]

Hi all,
I have the development version of org-mode and org-babel noweb style
references are not expanding during evaluation, they are instead copied
literally into the temp file. They seem to expand fine when tangling. Here
is file that is failing:
* Root
#+begin_src haskell :noweb yes :tangle Main.hs
  <<Imports>>
  <<Test>>
  main = print $ test [1,2,3]
#+end_src

* Imports
#+srcname: Imports
#+begin_src haskell
  import Control.Monad.State
#+end_src

* Append Function
#+srcname: Test
#+begin_src haskell
  test = length
#+end_src

I have tried unsuccessfully to make "Imports" and "Append Function" children
of "Root".

Thanks!
-deech

[-- Attachment #1.2: Type: text/html, Size: 783 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [SOLVED] [org-babel] References Not Expanding
  2010-08-21 21:42 [org-babel] References Not Expanding aditya siram
@ 2010-08-22 21:21 ` aditya siram
  2010-08-22 21:32   ` aditya siram
  0 siblings, 1 reply; 4+ messages in thread
From: aditya siram @ 2010-08-22 21:21 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 970 bytes --]

The function that loads the code block into the interpreter
org-babel-load-in-session does not do noweb reference expansion.

I have included a git patch that adds that functionality.

-deech

On Sat, Aug 21, 2010 at 4:42 PM, aditya siram <aditya.siram@gmail.com>wrote:

> Hi all,
> I have the development version of org-mode and org-babel noweb style
> references are not expanding during evaluation, they are instead copied
> literally into the temp file. They seem to expand fine when tangling. Here
> is file that is failing:
> * Root
> #+begin_src haskell :noweb yes :tangle Main.hs
>   <<Imports>>
>   <<Test>>
>   main = print $ test [1,2,3]
> #+end_src
>
> * Imports
> #+srcname: Imports
> #+begin_src haskell
>   import Control.Monad.State
> #+end_src
>
> * Append Function
> #+srcname: Test
> #+begin_src haskell
>   test = length
> #+end_src
>
> I have tried unsuccessfully to make "Imports" and "Append Function"
> children of "Root".
>
> Thanks!
> -deech
>

[-- Attachment #1.2: Type: text/html, Size: 1337 bytes --]

[-- Attachment #2: noweb_references_expand_on_session_load.patch --]
[-- Type: text/x-diff, Size: 1000 bytes --]

From eeeece26be443438325bb985488bddc784432e97 Mon Sep 17 00:00:00 2001
From: Aditya Siram <aditya.siram@gmail.com>
Date: Sun, 22 Aug 2010 16:12:17 -0500
Subject: [PATCH] Noweb style references are now expanded with loading a code block in a session.

---
 lisp/ob.el |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lisp/ob.el b/lisp/ob.el
index 8557f09..2ecc1db 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -421,8 +421,12 @@ session."
   (interactive)
   (let* ((info (or info (org-babel-get-src-block-info)))
          (lang (nth 0 info))
-         (body (nth 1 info))
          (params (nth 2 info))
+         (body (setf (nth 1 info)
+		     (if (and (cdr (assoc :noweb params))
+                              (string= "yes" (cdr (assoc :noweb params))))
+                         (org-babel-expand-noweb-references info)
+		       (nth 1 info))))
          (session (cdr (assoc :session params)))
 	 (dir (cdr (assoc :dir params)))
 	 (default-directory
-- 
1.7.0.4


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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [SOLVED] [org-babel] References Not Expanding
  2010-08-22 21:21 ` [SOLVED] " aditya siram
@ 2010-08-22 21:32   ` aditya siram
  2010-08-25 18:22     ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: aditya siram @ 2010-08-22 21:32 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1176 bytes --]

The last patch is formatted for email. Here's the correct one. Sorry.
-deech

On Sun, Aug 22, 2010 at 4:21 PM, aditya siram <aditya.siram@gmail.com>wrote:

> The function that loads the code block into the interpreter
> org-babel-load-in-session does not do noweb reference expansion.
>
> I have included a git patch that adds that functionality.
>
> -deech
>
>
> On Sat, Aug 21, 2010 at 4:42 PM, aditya siram <aditya.siram@gmail.com>wrote:
>
>> Hi all,
>> I have the development version of org-mode and org-babel noweb style
>> references are not expanding during evaluation, they are instead copied
>> literally into the temp file. They seem to expand fine when tangling. Here
>> is file that is failing:
>> * Root
>> #+begin_src haskell :noweb yes :tangle Main.hs
>>   <<Imports>>
>>   <<Test>>
>>   main = print $ test [1,2,3]
>> #+end_src
>>
>> * Imports
>> #+srcname: Imports
>> #+begin_src haskell
>>   import Control.Monad.State
>> #+end_src
>>
>> * Append Function
>> #+srcname: Test
>> #+begin_src haskell
>>   test = length
>> #+end_src
>>
>> I have tried unsuccessfully to make "Imports" and "Append Function"
>> children of "Root".
>>
>> Thanks!
>> -deech
>>
>
>

[-- Attachment #1.2: Type: text/html, Size: 1833 bytes --]

[-- Attachment #2: noweb_references_expand_on_session_load.patch --]
[-- Type: text/x-diff, Size: 874 bytes --]

commit eeeece26be443438325bb985488bddc784432e97
Author: Aditya Siram <aditya.siram@gmail.com>
Date:   Sun Aug 22 16:12:17 2010 -0500

    Noweb style references are now expanded with loading a code block in a session.

diff --git a/lisp/ob.el b/lisp/ob.el
index 8557f09..2ecc1db 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -421,8 +421,12 @@ session."
   (interactive)
   (let* ((info (or info (org-babel-get-src-block-info)))
          (lang (nth 0 info))
-         (body (nth 1 info))
          (params (nth 2 info))
+         (body (setf (nth 1 info)
+		     (if (and (cdr (assoc :noweb params))
+                              (string= "yes" (cdr (assoc :noweb params))))
+                         (org-babel-expand-noweb-references info)
+		       (nth 1 info))))
          (session (cdr (assoc :session params)))
 	 (dir (cdr (assoc :dir params)))
 	 (default-directory

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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Re: [SOLVED] [org-babel] References Not Expanding
  2010-08-22 21:32   ` aditya siram
@ 2010-08-25 18:22     ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2010-08-25 18:22 UTC (permalink / raw)
  To: aditya siram; +Cc: emacs-orgmode

Thanks for this patch, I've just applied it. -- Eric

aditya siram <aditya.siram@gmail.com> writes:

> The last patch is formatted for email. Here's the correct one. Sorry.
> -deech
>
> On Sun, Aug 22, 2010 at 4:21 PM, aditya siram <aditya.siram@gmail.com>wrote:
>
>> The function that loads the code block into the interpreter
>> org-babel-load-in-session does not do noweb reference expansion.
>>
>> I have included a git patch that adds that functionality.
>>
>> -deech
>>
>>
>> On Sat, Aug 21, 2010 at 4:42 PM, aditya siram <aditya.siram@gmail.com>wrote:
>>
>>> Hi all,
>>> I have the development version of org-mode and org-babel noweb style
>>> references are not expanding during evaluation, they are instead copied
>>> literally into the temp file. They seem to expand fine when tangling. Here
>>> is file that is failing:
>>> * Root
>>> #+begin_src haskell :noweb yes :tangle Main.hs
>>>   <<Imports>>
>>>   <<Test>>
>>>   main = print $ test [1,2,3]
>>> #+end_src
>>>
>>> * Imports
>>> #+srcname: Imports
>>> #+begin_src haskell
>>>   import Control.Monad.State
>>> #+end_src
>>>
>>> * Append Function
>>> #+srcname: Test
>>> #+begin_src haskell
>>>   test = length
>>> #+end_src
>>>
>>> I have tried unsuccessfully to make "Imports" and "Append Function"
>>> children of "Root".
>>>
>>> Thanks!
>>> -deech
>>>
>>
>>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-25 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-21 21:42 [org-babel] References Not Expanding aditya siram
2010-08-22 21:21 ` [SOLVED] " aditya siram
2010-08-22 21:32   ` aditya siram
2010-08-25 18:22     ` Eric Schulte

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).