emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Babel] [Ann] varied updates and improvements
@ 2010-10-21 14:18 Eric Schulte
  2011-01-01 20:41 ` Thomas S. Dye
  2011-01-01 21:01 ` Thomas S. Dye
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Schulte @ 2010-10-21 14:18 UTC (permalink / raw)
  To: Org Mode

Hello Babblers,

I've just merged in a large group of changes to Babel (authored by Dan
and myself) including a couple of user-visible enhancements and a
significant cleanup of the code base.  More information is available in
the Changes.org file (relevant sections included below).

Best -- Eric

Incompatible Changes 
=====================

Code block hashes 
------------------
Due to changes in the code resolving code block header arguments
hashing of code block results should now re-run a code block when
an argument to the code block has changed.  As a result of this
change *all* code blocks with cached results will be re-run after
upgrading to the latest version.

Testing update 
---------------
Anyone using the org-mode test suite will need to update the jump
repository for test navigation by executing the following from
the root of the org-mode repository.
git submodule update
Failure to update this repository will cause loading of
org-test.el to throw errors.

Details 
========

Multi-line header arguments to code blocks 
-------------------------------------------
Code block header arguments can now span multiple lines using the
new =#+header:= or =#+headers:= lines preceding a code block or
nested in between the name and body of a named code block.
Examples are given below.

- multi-line header arguments on an un-named code block
  #+headers: :var data1=1
  #+begin_src emacs-lisp :var data2=2
    (message "data1:%S, data2:%S" data1 data2)
  #+end_src
  
  #+results:
  : data1:1, data2:2

- multi-line header arguments on a named code block
    #+source: named-block
    #+header: :var data=2
    #+begin_src emacs-lisp
      (message "data:%S" data)
    #+end_src
  
    #+results: named-block
    : data:2

Unified handling of variable expansion for code blocks 
-------------------------------------------------------
The code used to resolve variable references in code block header
arguments has now been consolidated.  This both simplifies the
code base (especially the language-specific files), and ensures
that the arguments to a code block will not be evaluated multiple
times.  This change should not be externally visible to the
Org-mode user.

Improved Caching 
-----------------
Code block caches now notice if the value of a variable argument
to the code block has changed, if this is the case the cache is
invalidated and the code block is re-run.  The following example
can provide intuition for the new behavior.

  #+srcname: random
  #+begin_src R :cache yes
  runif(1)
  #+end_src
  
  #+results[a2a72cd647ad44515fab62e144796432793d68e1]: random
  0.4659510825295
  
  #+srcname: caller
  #+begin_src emacs-lisp :var x=random :cache yes
  x
  #+end_src
  
  #+results[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
  0.254227238707244

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

* Re: [Babel] [Ann] varied updates and improvements
  2010-10-21 14:18 [Babel] [Ann] varied updates and improvements Eric Schulte
@ 2011-01-01 20:41 ` Thomas S. Dye
  2011-01-01 21:09   ` Thomas S. Dye
  2011-01-01 21:01 ` Thomas S. Dye
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2011-01-01 20:41 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode


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

Aloha all,

Code block caching doesn't seem to notice if the value of a variable  
argument has changed.  Here is what I get with Org-mode version  
7.01trans (release_7.4.93.g40264e.dirty) when I run both code blocks  
(I'm expecting caller to recognize that random has changed).

#+srcname: random
#+begin_src R :cache yes
runif(3)
#+end_src

#+results[bbaaac2c187b718287fb9e9b60dc3d096eca28c0]: random
| 0.292331680655479 |
| 0.547373940004036 |
| 0.770326626254246 |


#+srcname: caller
#+begin_src emacs-lisp :var x=random :cache yes
x
#+end_src

#+results[9e659075e616e3fc068e697bd3aff9d0bfa0f5d8]: caller
: 0.707728253444657

Tom

On Oct 21, 2010, at 4:18 AM, Eric Schulte wrote:

> Improved Caching
> -----------------
> Code block caches now notice if the value of a variable argument
> to the code block has changed, if this is the case the cache is
> invalidated and the code block is re-run.  The following example
> can provide intuition for the new behavior.
>
>  #+srcname: random
>  #+begin_src R :cache yes
>  runif(1)
>  #+end_src
>
>  #+results[a2a72cd647ad44515fab62e144796432793d68e1]: random
>  0.4659510825295
>
>  #+srcname: caller
>  #+begin_src emacs-lisp :var x=random :cache yes
>  x
>  #+end_src
>
>  #+results[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
>  0.254227238707244



Thomas S. Dye, Ph.D.
T. S. Dye & Colleagues, Archaeologists, Inc.
Phone: (808) 529-0866 Fax: (808) 529-0884
http://www.tsdye.com



[-- Attachment #1.2: Type: text/html, Size: 4308 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: [Babel] [Ann] varied updates and improvements
  2010-10-21 14:18 [Babel] [Ann] varied updates and improvements Eric Schulte
  2011-01-01 20:41 ` Thomas S. Dye
@ 2011-01-01 21:01 ` Thomas S. Dye
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas S. Dye @ 2011-01-01 21:01 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode

Aloha all,

I'm seeing some unexpected behavior with source blocks as I'm  
adding :cache yes as a multi-line header argument.  The top #+results:  
is with the addition of the #+header: :cache yes line.  Note the lack  
of a :results name and also the lack of the SHA1 hash.  The bottom # 
+results: line is the result before addition of the #+header: line.

#+srcname: r-edge-angle-histogram
#+header: :cache yes
#+begin_src R :results output :var x=whole-adzes :file r/ 
adze_edge_angle.png :width 400 :height 300
   library(ggplot2)
   adze.edge.angle <- ggplot(x, aes(edge_angle))
   adze.edge.angle + geom_histogram(aes(y=..density..)) +
   geom_density(weight=2) + xlab("Measured cutting edge angle  
(degrees)")
#+end_src

#+results:
[[file:r/adze_edge_angle.png]]

#+results: r-edge-angle-histogram
[[file:r/adze_edge_angle.png]]


All the best,
Tom

On Oct 21, 2010, at 4:18 AM, Eric Schulte wrote:

> Multi-line header arguments to code blocks
> -------------------------------------------
> Code block header arguments can now span multiple lines using the
> new =#+header:= or =#+headers:= lines preceding a code block or
> nested in between the name and body of a named code block.
> Examples are given below.
>
> - multi-line header arguments on an un-named code block
>  #+headers: :var data1=1
>  #+begin_src emacs-lisp :var data2=2
>    (message "data1:%S, data2:%S" data1 data2)
>  #+end_src
>
>  #+results:
>  : data1:1, data2:2
>
> - multi-line header arguments on a named code block
>    #+source: named-block
>    #+header: :var data=2
>    #+begin_src emacs-lisp
>      (message "data:%S" data)
>    #+end_src
>
>    #+results: named-block
>    : data:2

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

* Re: [Babel] [Ann] varied updates and improvements
  2011-01-01 20:41 ` Thomas S. Dye
@ 2011-01-01 21:09   ` Thomas S. Dye
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas S. Dye @ 2011-01-01 21:09 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode


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

Aloha all,

Sorry for the noise.  I'm not sure how I was using version 7.01trans  
with release_7.4.93, but now that I'm using version 7.4 with that  
release, the code below works as expected.

Tom
On Jan 1, 2011, at 10:41 AM, Thomas S. Dye wrote:

> Aloha all,
>
> Code block caching doesn't seem to notice if the value of a variable  
> argument has changed.  Here is what I get with Org-mode version  
> 7.01trans (release_7.4.93.g40264e.dirty) when I run both code blocks  
> (I'm expecting caller to recognize that random has changed).
>
> #+srcname: random
> #+begin_src R :cache yes
> runif(3)
> #+end_src
>
> #+results[bbaaac2c187b718287fb9e9b60dc3d096eca28c0]: random
> | 0.292331680655479 |
> | 0.547373940004036 |
> | 0.770326626254246 |
>
>
> #+srcname: caller
> #+begin_src emacs-lisp :var x=random :cache yes
> x
> #+end_src
>
> #+results[9e659075e616e3fc068e697bd3aff9d0bfa0f5d8]: caller
> : 0.707728253444657
>
> Tom
>
> On Oct 21, 2010, at 4:18 AM, Eric Schulte wrote:
>
>> Improved Caching
>> -----------------
>> Code block caches now notice if the value of a variable argument
>> to the code block has changed, if this is the case the cache is
>> invalidated and the code block is re-run.  The following example
>> can provide intuition for the new behavior.
>>
>>  #+srcname: random
>>  #+begin_src R :cache yes
>>  runif(1)
>>  #+end_src
>>
>>  #+results[a2a72cd647ad44515fab62e144796432793d68e1]: random
>>  0.4659510825295
>>
>>  #+srcname: caller
>>  #+begin_src emacs-lisp :var x=random :cache yes
>>  x
>>  #+end_src
>>
>>  #+results[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
>>  0.254227238707244
>
>
>
> Thomas S. Dye, Ph.D.
> T. S. Dye & Colleagues, Archaeologists, Inc.
> Phone: (808) 529-0866 Fax: (808) 529-0884
> http://www.tsdye.com
>
>
> _______________________________________________
> 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


[-- Attachment #1.2: Type: text/html, Size: 5264 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

end of thread, other threads:[~2011-01-01 21:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-21 14:18 [Babel] [Ann] varied updates and improvements Eric Schulte
2011-01-01 20:41 ` Thomas S. Dye
2011-01-01 21:09   ` Thomas S. Dye
2011-01-01 21:01 ` Thomas S. Dye

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