emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

#+include from same file when exporting


From: edgar
Subject: #+include from same file when exporting
Date: Wed, 16 Sep 2020 01:14:30 +0000
User-agent: Roundcube Webmail/1.2.3

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 via email to

[Prev in Thread] Current Thread [Next in Thread]