emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: edgar@openmail.cc
To: emacs-orgmode@gnu.org
Subject: #+include from same file when exporting
Date: Wed, 16 Sep 2020 01:14:30 +0000	[thread overview]
Message-ID: <8be324038f986bd7160e36939f0f9809@openmail.cc> (raw)

Hello, dear list!

My comment for today is that I have something like this:

this-file.org
..............................
* Fancy header 1

#+NAME: blk1
#+begin_src python
   import numpy as np
#+end_src

** Fancy subheader 2

Res 1
#+include: "this-file.org::blk1"

Res 2
#+include: "this-file.org::blk1" src python

Res 3
#+include: "./this-file.org::blk1" src python
.............................. end

When I export /Fancy subheader 2/ as text, I get

this-file.txt
..............................
			  ━━━━━━━━━━━━━━━━━━━
			   FANCY SUBHEADER 2
			  ━━━━━━━━━━━━━━━━━━━


Table of Contents
─────────────────




Res 1
┌────
│ import numpy as np
└────

Res 2
┌────
│ * Fancy header 1
│
│ #+NAME: blk1
│ #+begin_src python
│   import numpy as np
│ #+end_src
│
│ ** Fancy subheader 2
│
│ Res 1
│ #+include: "this-file.org::blk1"
│
│ Res 2
│ #+include: "this-file.org::blk1" src python
│
│ Res 3
│ #+include: "./this-file.org::blk1" src python
└────

Res 3
┌────
│ * Fancy header 1
│
│ #+NAME: blk1
│ #+begin_src python
│   import numpy as np
│ #+end_src
│
│ ** Fancy subheader 2
│
│ Res 1
│ #+include: "this-file.org::blk1"
│
│ Res 2
│ #+include: "this-file.org::blk1" src python
│
│ Res 3
│ #+include: "./this-file.org::blk1" src python
└────
.............................. end

I think that all of them should just export the python block, right?

Also, I think that it would be very useful to have something like this:

another-file.org
..............................
* Fancy header 1

#+NAME: blk1
#+begin_src python :exports none
   print(2)
#+end_src

#+RESULTS:
: 2

** Fancy subheader 2

Res 1
#+include: "this-file.org::blk1" src python :exports both
.............................. end

Which would allow to have the =#+include= override the =:exports= 
directive from the original block and get the results from the block. 
Right now, I can do

yaf.org
..............................
* Fancy header 1

#+NAME: blk1
#+begin_src python
   print(2)
#+end_src

** Fancy subheader 2

Res 1
#+begin_src python :noweb yes :exports both
   <<blk1>>
#+end_src

#+RESULTS:
: 2
.............................. end

to get the same result, but I thought that this could be a nice feature 
to add.


GNU Emacs 27.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.21, 
cairo version 1.17.3) of 2020-09-08

Org mode version 9.3.7 (release_9.3.7-25-g4f22fd @ 
/home/edgar/.emacs.d/org-mode/lisp/)

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse@vfemail.net
 
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  


             reply	other threads:[~2020-09-16  1:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  1:14 edgar [this message]
2020-10-13 19:51 ` Nicolas Goaziou

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=8be324038f986bd7160e36939f0f9809@openmail.cc \
    --to=edgar@openmail.cc \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: #+include from same file when exporting' \
    /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

Code repositories for project(s) associated with this 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).