emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* exporting, using names, and inline source code blocks
@ 2012-09-15  8:18 Erich Neuwirth
  2012-09-15 16:37 ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Erich Neuwirth @ 2012-09-15  8:18 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org emacs-orgmode@gnu.org

I am using the latest version from ELPA, 20120903, OSX 10.8.1, and Emacs 24.2.1

The following document describes something which I perceive as strange behavior and a wish at the end.

#+title: Names test


Define a name with a value

#+name: nameval
#+begin_src elisp :session *elisp* :results value :exports both
321
#+end_src

The above does not export the value to LaTeX-pdf export if it is not executed
with C-c C-c in the document

Define a value in elisp

#+begin_src elisp :session *elisp* :results value :exports both
(setq lispval 123)
#+end_src


The above does not export the value to LaTeX-pdf export if it is not executed
with C-c C-c in the document


Simple call to =src_elisp= lispval equals 
src_elisp[:session *elisp* :results raw]{lispval}


The above does not export the value to LaTeX-pdf export if it is not executed
with C-c C-c in the document


Enhanced call to =src_elisp= lispval equals 
src_elisp[:session *elisp* :results raw :exports results]{lispval}


The above does not export the value to LaTeX-pdf export if it is not executed
with C-c C-c in the document

I tried exporting both to LaTeX-pdf and to html.


I would like a way which would allow me to use the value of the name =nameval=
inline

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

* Re: exporting, using names, and inline source code blocks
  2012-09-15  8:18 exporting, using names, and inline source code blocks Erich Neuwirth
@ 2012-09-15 16:37 ` Eric Schulte
  2012-09-15 22:11   ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2012-09-15 16:37 UTC (permalink / raw)
  To: Erich Neuwirth; +Cc: Nicolas Goaziou, Org Mode Mailing List

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

Erich Neuwirth <erich.neuwirth@univie.ac.at> writes:

> I am using the latest version from ELPA, 20120903, OSX 10.8.1, and Emacs 24.2.1
>
> The following document describes something which I perceive as strange behavior and a wish at the end.
>

There are a couple of things happening here.

Some can be fixed by adjusting the syntax in your org-mode file.
"elisp" should not be used, rather use "emacs-lisp" and your blocks will
begin to be executed on export.  Also, Emacs Lisp does not support
sessions, so you may as well remove the session header arguments.  And
finally you *can* reference the result of a code block in an inline code
block.  See the attached [1] version of your example Org-mode file for
specifics.

You have also uncovered a bug in the export of inline code blocks
introduced by the following recent commit [2].  I've just pushed up a
new test case which exercises this bug, and which passes before this
commit and fails afterwards.

If you use the updated version of your example file, and either wait for
a bug fix to be pushed, or use a version of Org-mode which pre-dates
this commit you should get the export behavior you expect.

Nicolas, I'm unable to take the time to fix this bug at the moment,
however if you can address it, I suspect the following two items are
relevant.

1. lack of preservation of whitespace around inline src blocks, related
   to the use of :begin at line 166 in ob-exp.el

2. incorrect position of the point before `org-babel-exp-do-export' is
   called at line 181 in ob-exp.el.

Best,

Footnotes: 
[1]  

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: it.org --]
[-- Type: text/x-org, Size: 700 bytes --]

#+Title: Names test
#+Options: ^:nil

Define a named code block.
#+name: namecode
#+begin_src emacs-lisp :exports both
321
#+end_src

The above *does* export the value.

Technically a named value would be as follows.
#+name: nameval
: 456

Define a value in emacs-lisp
#+begin_src emacs-lisp :exports both
(setq lispval 123)
#+end_src

The above *does* export the value

Inline evaluation of lispval equals src_emacs-lisp[:results raw]{lispval}

The above *does* export the value.

This should now work with both to LaTeX-pdf and to html.

I would like a way which would allow me to use the value of the name
=namecode= inline.

You can do this with the following src_sh[:var it=namecode]{echo $it}.

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


[2]  
,----
| commit 3dce21a0a4464463e1a518ae5b6ca5aef0dbc3c8
| Author: Nicolas Goaziou <n.goaziou@gmail.com>
| Date:   Sun Aug 19 22:07:55 2012 +0200
| 
|     Rewrite Babel pre-processing functions
|     
|     * lisp/ob-exp.el (org-babel-exp-src-block): Remove unused argument.
|     (org-babel-exp-non-block-elements): Rewrite function using Org Element.
|     * lisp/org-exp-blocks.el (org-export-blocks-preprocess): Rewrite
|       function using Org Element.
`----

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

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

* Re: exporting, using names, and inline source code blocks
  2012-09-15 16:37 ` Eric Schulte
@ 2012-09-15 22:11   ` Nicolas Goaziou
  2012-09-15 23:30     ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2012-09-15 22:11 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Erich Neuwirth, Org Mode Mailing List

Hello,

Eric Schulte <eric.schulte@gmx.com> writes:

> Nicolas, I'm unable to take the time to fix this bug at the moment,
> however if you can address it, I suspect the following two items are
> relevant.

I think it should be fixed now. At least, all tests pass here.

Thanks for the heads up.


Regards,

-- 
Nicolas Goaziou

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

* Re: exporting, using names, and inline source code blocks
  2012-09-15 22:11   ` Nicolas Goaziou
@ 2012-09-15 23:30     ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2012-09-15 23:30 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Erich Neuwirth, Org Mode Mailing List

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Eric Schulte <eric.schulte@gmx.com> writes:
>
>> Nicolas, I'm unable to take the time to fix this bug at the moment,
>> however if you can address it, I suspect the following two items are
>> relevant.
>
> I think it should be fixed now. At least, all tests pass here.
>
> Thanks for the heads up.
>

Confirmed all passing here too.  Thanks for the quick fix!

>
>
> Regards,

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

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

end of thread, other threads:[~2012-09-15 23:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-15  8:18 exporting, using names, and inline source code blocks Erich Neuwirth
2012-09-15 16:37 ` Eric Schulte
2012-09-15 22:11   ` Nicolas Goaziou
2012-09-15 23:30     ` 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).