* excluding noweb references completely from exports
@ 2020-01-04 18:15 David Bremner
2020-01-05 8:11 ` Fraga, Eric
0 siblings, 1 reply; 8+ messages in thread
From: David Bremner @ 2020-01-04 18:15 UTC (permalink / raw)
To: emacs-orgmode
At the end you can find a cut down version of an org-mode file I am
using to generate some beamer slides. This works as written, but it
feels clumsy to use two src blocks for every snippet. I have tried
putting the <<include/animal-type.rkt>> in the main src block, but this
either generates a blank line or if I delete the newline after >>, the
export looks fine but the source is ugly to edit.
Any better ideas for how to do this? In case it's not clear, I want
include files in my tangled output that don't show in the beamer export.
Please CC me with any replies, I'm not on the list.
#+STARTUP: beamer
#+OPTIONS: toc:nil
#+PROPERTY: header-args :noweb strip-export :shebang "#lang plait" :tangle-mode (identity #o644)
#+BEGIN_SRC plait :tangle tangled.rkt :export none
<<include/animal-type.rkt>>
#+END_SRC
#+BEGIN_SRC plait :tangle tangled.rkt
#;(Snake 10 'Slimey 5)
; => compile error: 10 is not a Symbol
(Snake? (Snake 'Slimey 10 'rats)) ; => #t
(Snake? (Tiger 'Tony 12)) ; => #t
;(Snake? 10)
; => compile error
#+END_SRC
#+NAME: include/animal-type.rkt
#+BEGIN_SRC plait :export none
(define-type Animal
[Snake (name : Symbol) (weight : Number) (food : Symbol)]
[Tiger (name : Symbol) (weight : Number)])
#+END_SRC
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: excluding noweb references completely from exports
2020-01-04 18:15 excluding noweb references completely from exports David Bremner
@ 2020-01-05 8:11 ` Fraga, Eric
2020-01-05 10:27 ` David Bremner
2020-01-06 21:35 ` Samuel Wales
0 siblings, 2 replies; 8+ messages in thread
From: Fraga, Eric @ 2020-01-05 8:11 UTC (permalink / raw)
To: David Bremner; +Cc: emacs-orgmode@gnu.org
On Saturday, 4 Jan 2020 at 14:15, David Bremner wrote:
> Any better ideas for how to do this? In case it's not clear, I want
> include files in my tangled output that don't show in the beamer
> export.
Export and tangling are orthogonal to each other and are controlled
independently by their respectively keywords in the src header
lines. In other words, I am not sure I understand what one has to do
with the other.
Would you please give an example that does not work the way you want it?
--
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: excluding noweb references completely from exports
2020-01-05 8:11 ` Fraga, Eric
@ 2020-01-05 10:27 ` David Bremner
2020-01-06 7:06 ` Fraga, Eric
2020-01-06 21:35 ` Samuel Wales
1 sibling, 1 reply; 8+ messages in thread
From: David Bremner @ 2020-01-05 10:27 UTC (permalink / raw)
To: Fraga, Eric; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
> On Saturday, 4 Jan 2020 at 14:15, David Bremner wrote:
>> Any better ideas for how to do this? In case it's not clear, I want
>> include files in my tangled output that don't show in the beamer
>> export.
>
> Export and tangling are orthogonal to each other and are controlled
> independently by their respectively keywords in the src header
> lines. In other words, I am not sure I understand what one has to do
> with the other.
>
> Would you please give an example that does not work the way you want it?
The attached exports with a blank line after the comment, which I don't
want. The comment is just added to highlight the problem, so normally
the blank line is at the beginning of the exported code block.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mwe.org --]
[-- Type: text/x-org, Size: 584 bytes --]
#+STARTUP: beamer
#+OPTIONS: toc:nil
#+PROPERTY: header-args :noweb strip-export :shebang "#lang plait" :tangle-mode (identity #o644)
#+LATEX_HEADER: \usepackage{listings}
* A frame
#+BEGIN_SRC scheme :tangle tangled.rkt
; there is a blank line after this comment
<<include/animal-type.rkt>>
(Snake? (Snake 'Slimey 10 'rats)) ; => #t
(Snake? (Tiger 'Tony 12)) ; => #t
#+END_SRC
#+NAME: include/animal-type.rkt
#+BEGIN_SRC scheme :export none
(define-type Animal
[Snake (name : Symbol) (weight : Number) (food : Symbol)]
[Tiger (name : Symbol) (weight : Number)])
#+END_SRC
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: excluding noweb references completely from exports
2020-01-05 10:27 ` David Bremner
@ 2020-01-06 7:06 ` Fraga, Eric
0 siblings, 0 replies; 8+ messages in thread
From: Fraga, Eric @ 2020-01-06 7:06 UTC (permalink / raw)
To: David Bremner; +Cc: emacs-orgmode@gnu.org
On Sunday, 5 Jan 2020 at 06:27, David Bremner wrote:
> The attached exports with a blank line after the comment, which I don't
> want. The comment is just added to highlight the problem, so normally
> the blank line is at the beginning of the exported code block.
Oh, I see.
One approach would be to have a src block that uses noweb to bring in
*all* the various code snippets and have each snippet not include
anything else. The former would be tangled but the others not. This is
what I do generally: the noweb code block has no actual code but just
includes all the various bits.
HTH,
eric
--
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: excluding noweb references completely from exports
2020-01-05 8:11 ` Fraga, Eric
2020-01-05 10:27 ` David Bremner
@ 2020-01-06 21:35 ` Samuel Wales
2020-01-07 6:22 ` Fraga, Eric
1 sibling, 1 reply; 8+ messages in thread
From: Samuel Wales @ 2020-01-06 21:35 UTC (permalink / raw)
To: Fraga, Eric; +Cc: David Bremner, emacs-orgmode@gnu.org
On 1/5/20, Fraga, Eric <e.fraga@ucl.ac.uk> wrote:
> Export and tangling are orthogonal to each other and are controlled
> independently by their respectively keywords in the src header
> lines. In other words, I am not sure I understand what one has to do
> with the other.
[fyi my computer broke some time ago and i am only partly back so i
might have missed stuff.]
fyi i dimly recall that in babel's infancy, as a user new to lp and
using babel infrequently, i got confused about the difference while
reading the manual. in fact, i wondered if the two features could be
the same thing but refactored.
so even if david is not confused, i imagine some are.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: excluding noweb references completely from exports
2020-01-06 21:35 ` Samuel Wales
@ 2020-01-07 6:22 ` Fraga, Eric
2020-01-07 8:43 ` Tim Cross
2020-01-07 23:14 ` Samuel Wales
0 siblings, 2 replies; 8+ messages in thread
From: Fraga, Eric @ 2020-01-07 6:22 UTC (permalink / raw)
To: Samuel Wales; +Cc: David Bremner, emacs-orgmode@gnu.org
On Monday, 6 Jan 2020 at 14:35, Samuel Wales wrote:
> fyi i dimly recall that in babel's infancy, as a user new to lp and
> using babel infrequently, i got confused about the difference while
> reading the manual. in fact, i wondered if the two features could be
> the same thing but refactored.
Tangling is for extracting code(s) from a document; exporting is for
presentation or dissemination of that document.
--
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: excluding noweb references completely from exports
2020-01-07 6:22 ` Fraga, Eric
@ 2020-01-07 8:43 ` Tim Cross
2020-01-07 23:14 ` Samuel Wales
1 sibling, 0 replies; 8+ messages in thread
From: Tim Cross @ 2020-01-07 8:43 UTC (permalink / raw)
To: emacs-orgmode; +Cc: David Bremner
Fraga, Eric <e.fraga@ucl.ac.uk> writes:
> On Monday, 6 Jan 2020 at 14:35, Samuel Wales wrote:
>> fyi i dimly recall that in babel's infancy, as a user new to lp and
>> using babel infrequently, i got confused about the difference while
>> reading the manual. in fact, i wondered if the two features could be
>> the same thing but refactored.
>
> Tangling is for extracting code(s) from a document; exporting is for
> presentation or dissemination of that document.
Yes, that is how I have always thought of it. Exporting is about
exporting the document into a new format (PDF, HTML, Markdown etc). This
isn't really related to LP (it could be seen as a bit like 'weave' in LP
jargon I guess). Even without Babel, you would still want export in
order to publish your org documents in different formats.
Tangle on the other hand is the guts of LP. It is what extracts the code
in the source blocks into 'raw' code files i.e. *.c, *.java, *.py etc
and adds things like noweb references to enable you to build complete
source files from multiple separate source blocks (with references
etc). In addition, it provides the powerful feature of being able to
generate 'new' (results) content from your source blocks and insert
them back into the document which can then be exported, providing a
mechanism to create more dynamic documents, which I find very useful for
documenting a workflow process where the document becomes a log of the
process as well as documentation on exactly what the process is/does.
A good example of this is https://www.youtube.com/watch?v=dljNabciEGg
--
Tim Cross
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: excluding noweb references completely from exports
2020-01-07 6:22 ` Fraga, Eric
2020-01-07 8:43 ` Tim Cross
@ 2020-01-07 23:14 ` Samuel Wales
1 sibling, 0 replies; 8+ messages in thread
From: Samuel Wales @ 2020-01-07 23:14 UTC (permalink / raw)
To: Fraga, Eric; +Cc: David Bremner, emacs-orgmode@gnu.org
On 1/6/20, Fraga, Eric <e.fraga@ucl.ac.uk> wrote:
> Tangling is for extracting code(s) from a document; exporting is for
> presentation or dissemination of that document.
actually i wasn't intending to ask for the difference. :) instead, i
was intending to say that i thuoght it was reasonable for a beginner
to be confused.
i think a beginner can reasonably think tangling is like exporting,
just a bit different. not orthogonal. so it's like "um, why both?"
i use both btw.
that probably soudns crazy so let me elaborate. if extracting uses
subsetting, that can be done by the :noexport: tag and perhaps similar
things in babel. if extracting is putting stuff in source code files,
that can be done by exporting to files.
so i think a newcomer can reasonably get confused. maybe just me and
idk if i have derailed the thread. in which case, never mind!
--
The Kafka Pandemic
What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-01-07 23:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-04 18:15 excluding noweb references completely from exports David Bremner
2020-01-05 8:11 ` Fraga, Eric
2020-01-05 10:27 ` David Bremner
2020-01-06 7:06 ` Fraga, Eric
2020-01-06 21:35 ` Samuel Wales
2020-01-07 6:22 ` Fraga, Eric
2020-01-07 8:43 ` Tim Cross
2020-01-07 23:14 ` Samuel Wales
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).