emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Erich Neuwirth <erich.neuwirth@univie.ac.at>
Cc: Nicolas Goaziou <n.goaziou@gmail.com>,
	Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: exporting, using names, and inline source code blocks
Date: Sat, 15 Sep 2012 10:37:26 -0600	[thread overview]
Message-ID: <87627fgs3d.fsf@gmx.com> (raw)
In-Reply-To: 89D00423-64CB-4537-9C6E-698891BE21DA@univie.ac.at

[-- 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

  reply	other threads:[~2012-09-15 16:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-15  8:18 exporting, using names, and inline source code blocks Erich Neuwirth
2012-09-15 16:37 ` Eric Schulte [this message]
2012-09-15 22:11   ` Nicolas Goaziou
2012-09-15 23:30     ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87627fgs3d.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=erich.neuwirth@univie.ac.at \
    --cc=n.goaziou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).