emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Berry, Charles" <ccberry@health.ucsd.edu>
To: Yasushi SHOJI <yasushi.shoji@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: exporter: How to get :file property on a src block in an exporter
Date: Thu, 23 Dec 2021 02:28:37 +0000	[thread overview]
Message-ID: <273F1CC7-8645-483C-BE65-6362743D69C7@health.ucsd.edu> (raw)
In-Reply-To: <CAELBRWLcCWghr3OE_Jox43xkZVXpxmVxsN+zh7G9ewWawBZE9w@mail.gmail.com>



> On Dec 22, 2021, at 2:16 PM, Yasushi SHOJI <yasushi.shoji@gmail.com> wrote:
> 
> Hi,
> 
> On Thu, Dec 23, 2021 at 3:22 AM Berry, Charles <ccberry@health.ucsd.edu> wrote:
>>> On Dec 22, 2021, at 8:07 AM, Yasushi SHOJI <yasushi.shoji@gmail.com> wrote:
>>> On Thu, Dec 23, 2021 at 12:52 AM Yasushi SHOJI <yasushi.shoji@gmail.com> wrote:
>>>> Then, why don't I have :file in the info?
>>> 
>>> The :exports must be "file" to have the file name in the info.  I used
>>> to have "code" because
>>> I wanted to export code with the file name as an attribute.
>> 
>> I don't see that here:
>> 
>> #+begin_src emacs-lisp :exports code :file abc
>>  (assq :file (caddr (org-babel-get-src-block-info 'light)))
>> #+end_src
>> 
>> #+RESULTS:
>> : (:file . abc)
> 
> Indeed, this one works.  But I don't see :file, or the whole
> :parameters in the info arg passed to my function.

Of course. Your function is called after the buffer is parsed.

> 
>> `org-export-as' runs `org-babel-exp-process-buffer' *before*  it parses the buffer and the header args get stripped from the copy buffer at that time.
> 
> Would you mind telling me where the stripping part is in the code, and
> the reason why it strips?

'...at that time' was meant to refer to when `org-babel-exp-process-buffer' runs. So look there.

Why? I didn't have a hand in that decision, but my guess is that almost always the header args are only useful in babel per se, so there is no reason to hang onto them.


> 
>> So you need to find a way to get the :file header arg whilst babel runs and hang onto it for later use.
> 
> I'm still learning but :parameters, which holds :file, are already
> gone from the info arg when org-myexporter-src-block is called.
> 

That is what I tried to say.

Best,
Chuck


      reply	other threads:[~2021-12-23  2:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 21:26 exporter: How to get :file property on a src block in an exporter Yasushi SHOJI
2021-12-22 14:34 ` Ihor Radchenko
2021-12-22 15:52   ` Yasushi SHOJI
2021-12-22 16:07     ` Yasushi SHOJI
2021-12-22 18:22       ` Berry, Charles
2021-12-22 22:16         ` Yasushi SHOJI
2021-12-23  2:28           ` Berry, Charles [this message]

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=273F1CC7-8645-483C-BE65-6362743D69C7@health.ucsd.edu \
    --to=ccberry@health.ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=yasushi.shoji@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).