emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* inline code block results
@ 2011-02-04 16:13 Andreas Leha
  2011-02-04 16:24 ` Andreas Leha
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Leha @ 2011-02-04 16:13 UTC (permalink / raw)
  To: emacs-orgmode


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

Hi all,

I have two questions:

(1)  How do I get resuts from code block evaluation (e.g. a single
number) inline into text during (LaTeX-)export?  Something like:  We use
a level of #+call: getLevel()

(2)  Why do these two subheadings produce different output during
(LaTeX-)export?
* Test
** Normal source code block
   The number is
   #+srcname: success_parameter_one
   #+begin_src R :session :results value :exports results
     tmp <- rnorm(1)
   #+end_src

** Inline source code block
   The number is src_R[:session :results value :exports results]{tmp <-
rnorm(1)}


Thanks in advance!
Andreas


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 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] 5+ messages in thread

* Re: inline code block results
  2011-02-04 16:13 inline code block results Andreas Leha
@ 2011-02-04 16:24 ` Andreas Leha
  2011-02-04 17:11   ` Dan Davison
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Leha @ 2011-02-04 16:24 UTC (permalink / raw)
  To: emacs-orgmode


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

Hi all,

just found out: the inline block works when I explicitly state :results
replace.

So both questions from the previous email collapse to: why is that
necessary?

Regards,
Andreas



Am 04.02.2011 17:13, schrieb Andreas Leha:
> Hi all,
>
> I have two questions:
>
> (1)  How do I get resuts from code block evaluation (e.g. a single
> number) inline into text during (LaTeX-)export?  Something like:  We use
> a level of #+call: getLevel()
>
> (2)  Why do these two subheadings produce different output during
> (LaTeX-)export?
> * Test
> ** Normal source code block
>    The number is
>    #+srcname: success_parameter_one
>    #+begin_src R :session :results value :exports results
>      tmp <- rnorm(1)
>    #+end_src
>
> ** Inline source code block
>    The number is src_R[:session :results value :exports results]{tmp <-
> rnorm(1)}
>
>
> Thanks in advance!
> Andreas
>
>   

-- 
Andreas Leha

Universitätsmedizin Göttingen
Abteilung Medizinische Statistik
Humboldtallee 32
37073 Göttingen

Tel: +49 (0)551 39-10710
Fax: +49 (0)551 39-4995

http://www.ams.med.uni-goettingen.de/amsneu/leha.html



University Medical Center Göttingen
Department for Medical Statistics
Humboldtallee 32
37073 Göttingen
Germany

Phone: +49 (0) 551 39-10710
Fax: +49 (0) 551 39-4995

http://www.ams.med.uni-goettingen.de/amsneu/leha-en.html



[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 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] 5+ messages in thread

* Re: inline code block results
  2011-02-04 16:24 ` Andreas Leha
@ 2011-02-04 17:11   ` Dan Davison
  2011-02-04 17:26     ` Andreas Leha
  2011-02-04 20:29     ` Eric Schulte
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Davison @ 2011-02-04 17:11 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Hi all,
>
> just found out: the inline block works when I explicitly state :results
> replace.
>
> So both questions from the previous email collapse to: why is that
> necessary?
>
> Regards,
> Andreas
>
>
>
> Am 04.02.2011 17:13, schrieb Andreas Leha:
>> Hi all,
>>
>> I have two questions:
>>
>> (1)  How do I get resuts from code block evaluation (e.g. a single
>> number) inline into text during (LaTeX-)export?  Something like:  We use
>> a level of #+call: getLevel()
>>
>> (2)  Why do these two subheadings produce different output during
>> (LaTeX-)export?
>> * Test
>> ** Normal source code block
>>    The number is
>>    #+srcname: success_parameter_one
>>    #+begin_src R :session :results value :exports results
>>      tmp <- rnorm(1)
>>    #+end_src
>>
>> ** Inline source code block
>>    The number is src_R[:session :results value :exports results]{tmp <-
>> rnorm(1)}

Hi Andreas,

This is a bug, thanks. They should both produce the number (and no code)
in the exported material.

It bisects to d0ca215105 which is a recent commit re-working export of
inline- and regular src blocks. I believe the fix may be as below but
I'll let Eric S check that.

Note that in your inline src block :results value and :exports results
are usually unnecessary, as they are the default values for inline src
blocks.

Dan

diff --git a/lisp/ob.el b/lisp/ob.el
index b899410..3fecbbd 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -297,7 +297,7 @@ specific header arguments as well.")
   "Default arguments to use when evaluating a source block.")
 
 (defvar org-babel-default-inline-header-args
-  '((:session . "none") (:results . "silent") (:exports . "results"))
+  '((:session . "none") (:results . "replace") (:exports . "results"))
   "Default arguments to use when evaluating an inline source block.")
 
 (defvar org-babel-current-buffer-properties nil



>>
>>
>> Thanks in advance!
>> Andreas
>>
>>   

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

* Re: inline code block results
  2011-02-04 17:11   ` Dan Davison
@ 2011-02-04 17:26     ` Andreas Leha
  2011-02-04 20:29     ` Eric Schulte
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Leha @ 2011-02-04 17:26 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode


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

Hi Dan,

Thanks for looking into this and for providing a patch that fast!

Andreas


Am 04.02.2011 18:11, schrieb Dan Davison:
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>   
>> Hi all,
>>
>> just found out: the inline block works when I explicitly state :results
>> replace.
>>
>> So both questions from the previous email collapse to: why is that
>> necessary?
>>
>> Regards,
>> Andreas
>>
>>
>>
>> Am 04.02.2011 17:13, schrieb Andreas Leha:
>>     
>>> Hi all,
>>>
>>> I have two questions:
>>>
>>> (1)  How do I get resuts from code block evaluation (e.g. a single
>>> number) inline into text during (LaTeX-)export?  Something like:  We use
>>> a level of #+call: getLevel()
>>>
>>> (2)  Why do these two subheadings produce different output during
>>> (LaTeX-)export?
>>> * Test
>>> ** Normal source code block
>>>    The number is
>>>    #+srcname: success_parameter_one
>>>    #+begin_src R :session :results value :exports results
>>>      tmp <- rnorm(1)
>>>    #+end_src
>>>
>>> ** Inline source code block
>>>    The number is src_R[:session :results value :exports results]{tmp <-
>>> rnorm(1)}
>>>       
> Hi Andreas,
>
> This is a bug, thanks. They should both produce the number (and no code)
> in the exported material.
>
> It bisects to d0ca215105 which is a recent commit re-working export of
> inline- and regular src blocks. I believe the fix may be as below but
> I'll let Eric S check that.
>
> Note that in your inline src block :results value and :exports results
> are usually unnecessary, as they are the default values for inline src
> blocks.
>
> Dan
>
> diff --git a/lisp/ob.el b/lisp/ob.el
> index b899410..3fecbbd 100644
> --- a/lisp/ob.el
> +++ b/lisp/ob.el
> @@ -297,7 +297,7 @@ specific header arguments as well.")
>    "Default arguments to use when evaluating a source block.")
>  
>  (defvar org-babel-default-inline-header-args
> -  '((:session . "none") (:results . "silent") (:exports . "results"))
> +  '((:session . "none") (:results . "replace") (:exports . "results"))
>    "Default arguments to use when evaluating an inline source block.")
>  
>  (defvar org-babel-current-buffer-properties nil
>
>
>
>   
>>>
>>> Thanks in advance!
>>> Andreas
>>>
>>>   
>>>       

-- 
Andreas Leha

Universitätsmedizin Göttingen
Abteilung Medizinische Statistik
Humboldtallee 32
37073 Göttingen

Tel: +49 (0)551 39-10710
Fax: +49 (0)551 39-4995

http://www.ams.med.uni-goettingen.de/amsneu/leha.html



University Medical Center Göttingen
Department for Medical Statistics
Humboldtallee 32
37073 Göttingen
Germany

Phone: +49 (0) 551 39-10710
Fax: +49 (0) 551 39-4995

http://www.ams.med.uni-goettingen.de/amsneu/leha-en.html



[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 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] 5+ messages in thread

* Re: inline code block results
  2011-02-04 17:11   ` Dan Davison
  2011-02-04 17:26     ` Andreas Leha
@ 2011-02-04 20:29     ` Eric Schulte
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Schulte @ 2011-02-04 20:29 UTC (permalink / raw)
  To: Dan Davison; +Cc: Andreas Leha, emacs-orgmode

Dan Davison <dandavison7@gmail.com> writes:

> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> Hi all,
>>
>> just found out: the inline block works when I explicitly state :results
>> replace.
>>
>> So both questions from the previous email collapse to: why is that
>> necessary?
>>
>> Regards,
>> Andreas
>>
>>
>>
>> Am 04.02.2011 17:13, schrieb Andreas Leha:
>>> Hi all,
>>>
>>> I have two questions:
>>>
>>> (1)  How do I get resuts from code block evaluation (e.g. a single
>>> number) inline into text during (LaTeX-)export?  Something like:  We use
>>> a level of #+call: getLevel()
>>>
>>> (2)  Why do these two subheadings produce different output during
>>> (LaTeX-)export?
>>> * Test
>>> ** Normal source code block
>>>    The number is
>>>    #+srcname: success_parameter_one
>>>    #+begin_src R :session :results value :exports results
>>>      tmp <- rnorm(1)
>>>    #+end_src
>>>
>>> ** Inline source code block
>>>    The number is src_R[:session :results value :exports results]{tmp <-
>>> rnorm(1)}
>
> Hi Andreas,
>
> This is a bug, thanks. They should both produce the number (and no code)
> in the exported material.
>
> It bisects to d0ca215105 which is a recent commit re-working export of
> inline- and regular src blocks. I believe the fix may be as below but
> I'll let Eric S check that.
>
> Note that in your inline src block :results value and :exports results
> are usually unnecessary, as they are the default values for inline src
> blocks.
>

Yes,

I've just applied this change.  Note that the variables like
`org-babel-default-*-header-args' are intended for users to customize in
their local config, so don't shy away from changing the default settings
locally.

I think I set the default to silent thinking that whenever I would
interactively execute an inline code block, I would want to see the
results in the message area, rather than actually insert them inline.

Best -- Eric

>
> Dan
>
> diff --git a/lisp/ob.el b/lisp/ob.el
> index b899410..3fecbbd 100644
> --- a/lisp/ob.el
> +++ b/lisp/ob.el
> @@ -297,7 +297,7 @@ specific header arguments as well.")
>    "Default arguments to use when evaluating a source block.")
>  
>  (defvar org-babel-default-inline-header-args
> -  '((:session . "none") (:results . "silent") (:exports . "results"))
> +  '((:session . "none") (:results . "replace") (:exports . "results"))
>    "Default arguments to use when evaluating an inline source block.")
>  
>  (defvar org-babel-current-buffer-properties nil
>
>
>
>>>
>>>
>>> Thanks in advance!
>>> Andreas
>>>
>>>   

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

end of thread, other threads:[~2011-02-04 20:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-04 16:13 inline code block results Andreas Leha
2011-02-04 16:24 ` Andreas Leha
2011-02-04 17:11   ` Dan Davison
2011-02-04 17:26     ` Andreas Leha
2011-02-04 20:29     ` 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).