* [babel] Why #+name: is not a member of params?
@ 2012-06-06 0:19 Mikhail Titov
2012-06-06 0:42 ` Eric Schulte
0 siblings, 1 reply; 3+ messages in thread
From: Mikhail Titov @ 2012-06-06 0:19 UTC (permalink / raw)
To: emacs-orgmode
Hello!
I’d like to insert a comment into tangle output with a block name. I thought I could easily access it (like from org-babel-expand-body:XXX function) with
(cdr (assq :name params))
But apparently it does not work. When I do C-c C-v C-v trying to expand body, I get nil as it is not there.
Did I miss something?
I want that so each block appears in individual Matlab code cell [1].
[1] http://www.mathworks.com/help/techdoc/matlab_env/brqxeeu-259.html
Mikhail
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [babel] Why #+name: is not a member of params?
2012-06-06 0:19 [babel] Why #+name: is not a member of params? Mikhail Titov
@ 2012-06-06 0:42 ` Eric Schulte
2012-06-06 0:53 ` Mikhail Titov
0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2012-06-06 0:42 UTC (permalink / raw)
To: Mikhail Titov; +Cc: emacs-orgmode
"Mikhail Titov" <mlt@gmx.us> writes:
> Hello!
>
> I’d like to insert a comment into tangle output with a block name. I thought I could easily access it (like from org-babel-expand-body:XXX function) with
>
> (cdr (assq :name params))
>
> But apparently it does not work. When I do C-c C-v C-v trying to expand body, I get nil as it is not there.
>
> Did I miss something?
>
> I want that so each block appears in individual Matlab code cell [1].
>
> [1] http://www.mathworks.com/help/techdoc/matlab_env/brqxeeu-259.html
>
> Mikhail
>
Hi Mikhail,
The code block name is not a member of params. Params only holds header
arguments, not other meta data like the name. The code block name is
stored in the `info' list which is active while the code block is being
processed, so you could access it with something like the following,
although which is relying on an implementation detail that is not part
of the formal spec (i.e., cheating) and could change.
#+name: foo
#+begin_src emacs-lisp
(nth 4 info)
#+end_src
#+RESULTS: foo
: foo
Best,
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [babel] Why #+name: is not a member of params?
2012-06-06 0:42 ` Eric Schulte
@ 2012-06-06 0:53 ` Mikhail Titov
0 siblings, 0 replies; 3+ messages in thread
From: Mikhail Titov @ 2012-06-06 0:53 UTC (permalink / raw)
To: 'Eric Schulte'; +Cc: emacs-orgmode
> -----Original Message-----
> From: Eric Schulte [mailto:eric.schulte@gmx.com]
> Sent: Tuesday, June 05, 2012 7:42 PM
> To: Mikhail Titov
> Cc: emacs-orgmode@gnu.org
> Subject: Re: [O] [babel] Why #+name: is not a member of params?
>
> "Mikhail Titov" <mlt@gmx.us> writes:
>
> > Hello!
> >
> > I’d like to insert a comment into tangle output with a block name. I thought
> I could easily access it (like from org-babel-expand-body:XXX function) with
> >
> > (cdr (assq :name params))
> >
> ...
>
> The code block name is not a member of params. Params only holds header
> arguments, not other meta data like the name. The code block name is
> stored in the `info' list which is active while the code block is being
> processed, so you could access it with something like the following,
> although which is relying on an implementation detail that is not part
> of the formal spec (i.e., cheating) and could change.
>
> #+name: foo
> #+begin_src emacs-lisp
> (nth 4 info)
> #+end_src
>
> #+RESULTS: foo
> : foo
Thank you, Eric!
Marvelous! It does what I want. I see its definition in ob.el .
M.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-06 1:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06 0:19 [babel] Why #+name: is not a member of params? Mikhail Titov
2012-06-06 0:42 ` Eric Schulte
2012-06-06 0:53 ` Mikhail Titov
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).