emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Evaluating inline source blocks on export issue
@ 2014-07-23  1:50 Grant Rettke
  2014-07-23  2:39 ` Thomas S. Dye
  2014-07-23 12:43 ` Nick Dokos
  0 siblings, 2 replies; 8+ messages in thread
From: Grant Rettke @ 2014-07-23  1:50 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Good evening,

From [org-scraps] I pasted this example into a buffer:

,—-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 #+name: square
 #+begin_src emacs-lisp :var it=0
 (* it it)
 #+end_src

 Here is a call_square(it=4), stuck in the middle of some prose.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
`—-

When I export the buffer I get:

,—-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ╭────
 │   (* it it)
 ╰────

 Here is a , stuck in the middle of some prose.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
`—-

I expected a 16 to have appeared there.

I did double check that inline call blocks work on export:

╭────
│ (list org-export-babel-evaluate)
╰────

#+NAME:
| inline-only |

Clearly I am missing something.

What am I doing wrong here?

My environment:

╭────
│ (format "%S" (emacs-version))
╰────

#+NAME:
#+begin_example
"GNU Emacs 24.3.1 (x86_64-apple-darwin13.2.0, Carbon Version 1.6.0
AppKit 1265.2)
 of 2014-07-03 on orion"
#+end_example

╭────
│ (format "%S" (org-version))
╰────

#+NAME:
#+begin_example
"8.2.7a"
#+end_example

Kind regards,

gcr


[org-scraps]
https://raw.githubusercontent.com/eschulte/org-scraps/master/scraps.org

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

* Re: Evaluating inline source blocks on export issue
  2014-07-23  1:50 Evaluating inline source blocks on export issue Grant Rettke
@ 2014-07-23  2:39 ` Thomas S. Dye
  2014-07-23 12:43 ` Nick Dokos
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas S. Dye @ 2014-07-23  2:39 UTC (permalink / raw)
  To: Grant Rettke; +Cc: emacs-orgmode@gnu.org

Aloha Grant,

Grant Rettke <gcr@wisdomandwonder.com> writes:

> Good evening,
>
> From [org-scraps] I pasted this example into a buffer:
>
> ,—-
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>  #+name: square
>  #+begin_src emacs-lisp :var it=0
>  (* it it)
>  #+end_src
>
>  Here is a call_square(it=4), stuck in the middle of some prose.
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> `—-
>
> When I export the buffer I get:
>
> ,—-
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>  ╭────
>  │   (* it it)
>  ╰────

To get rid of the source code block in the export buffer, you can put it
under a heading that is tagged with :noexport:.  I keep a heading at the
end of most documents to hold source code blocks and find it convenient.
 
>
>  Here is a , stuck in the middle of some prose.
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> `—-

I'm not certain if this will fix your problem (untested), but I set
:results raw in this situation.  I use properties for this so the
call_foo() part stays a reasonable length:

 * Description of the Hawaiian Stone Axes
   :PROPERTIES:
   :RESULTS:  raw
   :END:

hth,
Tom

>
> I expected a 16 to have appeared there.
>
> I did double check that inline call blocks work on export:
>
> ╭────
> │ (list org-export-babel-evaluate)
> ╰────
>
> #+NAME:
> | inline-only |
>
> Clearly I am missing something.
>
> What am I doing wrong here?
>
> My environment:
>
> ╭────
> │ (format "%S" (emacs-version))
> ╰────
>
> #+NAME:
> #+begin_example
> "GNU Emacs 24.3.1 (x86_64-apple-darwin13.2.0, Carbon Version 1.6.0
> AppKit 1265.2)
>  of 2014-07-03 on orion"
> #+end_example
>
> ╭────
> │ (format "%S" (org-version))
> ╰────
>
> #+NAME:
> #+begin_example
> "8.2.7a"
> #+end_example
>
> Kind regards,
>
> gcr
>
>
> [org-scraps]
> https://raw.githubusercontent.com/eschulte/org-scraps/master/scraps.org

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: Evaluating inline source blocks on export issue
  2014-07-23  1:50 Evaluating inline source blocks on export issue Grant Rettke
  2014-07-23  2:39 ` Thomas S. Dye
@ 2014-07-23 12:43 ` Nick Dokos
  2014-07-23 13:20   ` Grant Rettke
  1 sibling, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2014-07-23 12:43 UTC (permalink / raw)
  To: emacs-orgmode

Grant Rettke <gcr@wisdomandwonder.com> writes:

> Good evening,
>
> From [org-scraps] I pasted this example into a buffer:
>
> ,—-
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>
>  #+name: square
>  #+begin_src emacs-lisp :var it=0
>
>  (* it it)
>  #+end_src
>
>  Here is a call_square(it=4), stuck in the middle of some prose.
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> `—-
>
> When I export the buffer I get:
>
> ,—-
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>  ╭────
>  │   (* it it)
>  ╰────
>
>  Here is a , stuck in the middle of some prose.
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> `—-
>
> I expected a 16 to have appeared there.
>

The following works for me:

--8<---------------cut here---------------start------------->8---
 #+name: square
 #+begin_src emacs-lisp :var it=0 :exports none
 (* it it)
 #+end_src

 Here is a call_square(it=4), stuck in the middle of some prose.
--8<---------------cut here---------------end--------------->8---

-- 
Nick

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

* Re: Evaluating inline source blocks on export issue
  2014-07-23 12:43 ` Nick Dokos
@ 2014-07-23 13:20   ` Grant Rettke
  2014-07-24  1:24     ` Nick Dokos
  0 siblings, 1 reply; 8+ messages in thread
From: Grant Rettke @ 2014-07-23 13:20 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode@gnu.org

Thanks for looking Thomas and Nick.

When I set this and export

,----
| (setq org-export-babel-evaluate t)
`----

I get the expected result of

,----
| Here is a `16', stuck in the middle of some prose.
`----

But when I do this and export

,----
| (setq org-export-babel-evaluate 'inline-only)
`----

I get this output which is not what I expected

,----
| Here is a , stuck in the middle of some prose.
`----

I thought that I was enabling inline code block execution correctly
and making the inline call correctly.

How does it look should it be doing what I had wanted?

I have not yet begun trimming down my org initialization, and trying
to decide when I need to start narrowing things down by deduction.
Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson


On Wed, Jul 23, 2014 at 7:43 AM, Nick Dokos <ndokos@gmail.com> wrote:
> Grant Rettke <gcr@wisdomandwonder.com> writes:
>
>> Good evening,
>>
>> From [org-scraps] I pasted this example into a buffer:
>>
>> ,—-
>> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>>
>>  #+name: square
>>  #+begin_src emacs-lisp :var it=0
>>
>>  (* it it)
>>  #+end_src
>>
>>  Here is a call_square(it=4), stuck in the middle of some prose.
>> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>> `—-
>>
>> When I export the buffer I get:
>>
>> ,—-
>> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>>  ╭────
>>  │   (* it it)
>>  ╰────
>>
>>  Here is a , stuck in the middle of some prose.
>> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>> `—-
>>
>> I expected a 16 to have appeared there.
>>
>
> The following works for me:
>
> --8<---------------cut here---------------start------------->8---
>  #+name: square
>  #+begin_src emacs-lisp :var it=0 :exports none
>  (* it it)
>  #+end_src
>
>  Here is a call_square(it=4), stuck in the middle of some prose.
> --8<---------------cut here---------------end--------------->8---
>
> --
> Nick
>
>

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

* Re: Evaluating inline source blocks on export issue
  2014-07-23 13:20   ` Grant Rettke
@ 2014-07-24  1:24     ` Nick Dokos
  2014-07-24 10:14       ` Andreas Leha
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2014-07-24  1:24 UTC (permalink / raw)
  To: emacs-orgmode

Grant Rettke <gcr@wisdomandwonder.com> writes:

> Thanks for looking Thomas and Nick.
>
> When I set this and export
>
> ,----
> | (setq org-export-babel-evaluate t)
> `----
>
> I get the expected result of
>
> ,----
> | Here is a `16', stuck in the middle of some prose.
> `----
>
> But when I do this and export
>
> ,----
> | (setq org-export-babel-evaluate 'inline-only)
> `----
>
> I get this output which is not what I expected
>
> ,----
> | Here is a , stuck in the middle of some prose.
> `----
>
> I thought that I was enabling inline code block execution correctly
> and making the inline call correctly.
>
> How does it look should it be doing what I had wanted?
>

I don't think you can: the `type' (see below) of the inline code is not
`inline' as one might think at first, but `lob', presumably because
call_foo is defined in the library-of-babel.

The relevant code is in ob-exp.el:org-babel-exp-results:

,----
|   ...
|   (when (and (or (eq org-export-babel-evaluate t)
| 		 (and (eq type 'inline)
| 		      (eq org-export-babel-evaluate 'inline-only)))
| 	     (not (and hash (equal hash (org-babel-current-result-hash)))))
|   ...
`----

-- 
Nick

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

* Re: Evaluating inline source blocks on export issue
  2014-07-24  1:24     ` Nick Dokos
@ 2014-07-24 10:14       ` Andreas Leha
  2014-07-25  1:53         ` Ista Zahn
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Leha @ 2014-07-24 10:14 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Grant Rettke <gcr@wisdomandwonder.com> writes:
>
>> Thanks for looking Thomas and Nick.
>>
>> When I set this and export
>>
>> ,----
>> | (setq org-export-babel-evaluate t)
>> `----
>>
>> I get the expected result of
>>
>> ,----
>> | Here is a `16', stuck in the middle of some prose.
>> `----
>>
>> But when I do this and export
>>
>> ,----
>> | (setq org-export-babel-evaluate 'inline-only)
>> `----
>>
>> I get this output which is not what I expected
>>
>> ,----
>> | Here is a , stuck in the middle of some prose.
>> `----
>>
>> I thought that I was enabling inline code block execution correctly
>> and making the inline call correctly.
>>
>> How does it look should it be doing what I had wanted?
>>
>
> I don't think you can: the `type' (see below) of the inline code is not
> `inline' as one might think at first, but `lob', presumably because
> call_foo is defined in the library-of-babel.
>
> The relevant code is in ob-exp.el:org-babel-exp-results:
>
> ,----
> |   ...
> |   (when (and (or (eq org-export-babel-evaluate t)
> | 		 (and (eq type 'inline)
> | 		      (eq org-export-babel-evaluate 'inline-only)))
> | 	     (not (and hash (equal hash (org-babel-current-result-hash)))))
> |   ...
> `----

Then I would like to turn this into a feature request:  Enable
inline-block-specific settings.

This does not only hold for the evaluation, but also for default header
arguments.  Different settings for inline code are quite useful.  I do
have to specify [:results raw] on the block-to-block basis quite a lot
and would benefit a lot from global inline-specific settings.

As always, point me to the way to do it, if (quite likely) this is
possible already.

Regards,
Andreas

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

* Re: Evaluating inline source blocks on export issue
  2014-07-24 10:14       ` Andreas Leha
@ 2014-07-25  1:53         ` Ista Zahn
  2014-07-25 18:01           ` Grant Rettke
  0 siblings, 1 reply; 8+ messages in thread
From: Ista Zahn @ 2014-07-25  1:53 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode Mailinglist

On Thu, Jul 24, 2014 at 6:14 AM, Andreas Leha
<andreas.leha@med.uni-goettingen.de> wrote:
> Nick Dokos <ndokos@gmail.com> writes:
>
>> Grant Rettke <gcr@wisdomandwonder.com> writes:
>>
>>> Thanks for looking Thomas and Nick.
>>>
>>> When I set this and export
>>>
>>> ,----
>>> | (setq org-export-babel-evaluate t)
>>> `----
>>>
>>> I get the expected result of
>>>
>>> ,----
>>> | Here is a `16', stuck in the middle of some prose.
>>> `----
>>>
>>> But when I do this and export
>>>
>>> ,----
>>> | (setq org-export-babel-evaluate 'inline-only)
>>> `----
>>>
>>> I get this output which is not what I expected
>>>
>>> ,----
>>> | Here is a , stuck in the middle of some prose.
>>> `----
>>>
>>> I thought that I was enabling inline code block execution correctly
>>> and making the inline call correctly.
>>>
>>> How does it look should it be doing what I had wanted?
>>>
>>
>> I don't think you can: the `type' (see below) of the inline code is not
>> `inline' as one might think at first, but `lob', presumably because
>> call_foo is defined in the library-of-babel.
>>
>> The relevant code is in ob-exp.el:org-babel-exp-results:
>>
>> ,----
>> |   ...
>> |   (when (and (or (eq org-export-babel-evaluate t)
>> |              (and (eq type 'inline)
>> |                   (eq org-export-babel-evaluate 'inline-only)))
>> |          (not (and hash (equal hash (org-babel-current-result-hash)))))
>> |   ...
>> `----
>
> Then I would like to turn this into a feature request:  Enable
> inline-block-specific settings.

I'm not sure if this solves your problem, but

--8<---------------cut here---------------start------------->8---
 #+name: squareFun
 #+begin_src emacs-lisp :exports none
   (defun square (it) (* it it))
 #+end_src

 #+RESULTS: squareFun
 : square

Here is a src_emacs-lisp{(square 10)}, from an inline source block.
--8<---------------cut here---------------end--------------->8---

does work with org-export-babel-evaluate set to 'inline-only. You do
have to evaluate the squareFun block before exporting.

Best,
Ista



>
> This does not only hold for the evaluation, but also for default header
> arguments.  Different settings for inline code are quite useful.  I do
> have to specify [:results raw] on the block-to-block basis quite a lot
> and would benefit a lot from global inline-specific settings.
>
> As always, point me to the way to do it, if (quite likely) this is
> possible already.
>
> Regards,
> Andreas
>
>

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

* Re: Evaluating inline source blocks on export issue
  2014-07-25  1:53         ` Ista Zahn
@ 2014-07-25 18:01           ` Grant Rettke
  0 siblings, 0 replies; 8+ messages in thread
From: Grant Rettke @ 2014-07-25 18:01 UTC (permalink / raw)
  To: Ista Zahn; +Cc: Andreas Leha, emacs-orgmode Mailinglist

Understood. Somehow got the call syntax suck in my head and didn't see
that the underscore named syntax only works for LoB stuff and works
perfectly when you just make a plain old language call.

Thanks!

This feature is really, really important.

Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson


On Thu, Jul 24, 2014 at 8:53 PM, Ista Zahn <istazahn@gmail.com> wrote:
> On Thu, Jul 24, 2014 at 6:14 AM, Andreas Leha
> <andreas.leha@med.uni-goettingen.de> wrote:
>> Nick Dokos <ndokos@gmail.com> writes:
>>
>>> Grant Rettke <gcr@wisdomandwonder.com> writes:
>>>
>>>> Thanks for looking Thomas and Nick.
>>>>
>>>> When I set this and export
>>>>
>>>> ,----
>>>> | (setq org-export-babel-evaluate t)
>>>> `----
>>>>
>>>> I get the expected result of
>>>>
>>>> ,----
>>>> | Here is a `16', stuck in the middle of some prose.
>>>> `----
>>>>
>>>> But when I do this and export
>>>>
>>>> ,----
>>>> | (setq org-export-babel-evaluate 'inline-only)
>>>> `----
>>>>
>>>> I get this output which is not what I expected
>>>>
>>>> ,----
>>>> | Here is a , stuck in the middle of some prose.
>>>> `----
>>>>
>>>> I thought that I was enabling inline code block execution correctly
>>>> and making the inline call correctly.
>>>>
>>>> How does it look should it be doing what I had wanted?
>>>>
>>>
>>> I don't think you can: the `type' (see below) of the inline code is not
>>> `inline' as one might think at first, but `lob', presumably because
>>> call_foo is defined in the library-of-babel.
>>>
>>> The relevant code is in ob-exp.el:org-babel-exp-results:
>>>
>>> ,----
>>> |   ...
>>> |   (when (and (or (eq org-export-babel-evaluate t)
>>> |              (and (eq type 'inline)
>>> |                   (eq org-export-babel-evaluate 'inline-only)))
>>> |          (not (and hash (equal hash (org-babel-current-result-hash)))))
>>> |   ...
>>> `----
>>
>> Then I would like to turn this into a feature request:  Enable
>> inline-block-specific settings.
>
> I'm not sure if this solves your problem, but
>
> --8<---------------cut here---------------start------------->8---
>  #+name: squareFun
>  #+begin_src emacs-lisp :exports none
>    (defun square (it) (* it it))
>  #+end_src
>
>  #+RESULTS: squareFun
>  : square
>
> Here is a src_emacs-lisp{(square 10)}, from an inline source block.
> --8<---------------cut here---------------end--------------->8---
>
> does work with org-export-babel-evaluate set to 'inline-only. You do
> have to evaluate the squareFun block before exporting.
>
> Best,
> Ista
>
>
>
>>
>> This does not only hold for the evaluation, but also for default header
>> arguments.  Different settings for inline code are quite useful.  I do
>> have to specify [:results raw] on the block-to-block basis quite a lot
>> and would benefit a lot from global inline-specific settings.
>>
>> As always, point me to the way to do it, if (quite likely) this is
>> possible already.
>>
>> Regards,
>> Andreas
>>
>>
>

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

end of thread, other threads:[~2014-07-25 18:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23  1:50 Evaluating inline source blocks on export issue Grant Rettke
2014-07-23  2:39 ` Thomas S. Dye
2014-07-23 12:43 ` Nick Dokos
2014-07-23 13:20   ` Grant Rettke
2014-07-24  1:24     ` Nick Dokos
2014-07-24 10:14       ` Andreas Leha
2014-07-25  1:53         ` Ista Zahn
2014-07-25 18:01           ` Grant Rettke

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