From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Re: Org babel tangle: Don't export code Date: Tue, 24 Sep 2019 20:43:31 -0500 Message-ID: References: <87o8z9qony.fsf@gmail.com> <87muetqijb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000002624be059356c809" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37537) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCwLF-0000wc-DS for emacs-orgmode@gnu.org; Tue, 24 Sep 2019 21:43:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCwLD-0004qf-5H for emacs-orgmode@gnu.org; Tue, 24 Sep 2019 21:43:41 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:33049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iCwLC-0004qO-Pm for emacs-orgmode@gnu.org; Tue, 24 Sep 2019 21:43:39 -0400 Received: by mail-io1-xd2b.google.com with SMTP id z19so9464694ior.0 for ; Tue, 24 Sep 2019 18:43:38 -0700 (PDT) In-Reply-To: <87muetqijb.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Tim Cross Cc: emacs-orgmode --0000000000002624be059356c809 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Sep 24, 2019 at 8:19 PM Tim Cross wrote: > > There are two different concepts - tangling and exporting. When you > tangle the file, code blocks are written out into code files (possibly > with evaluation etc). This is part of the 'literate programming' support > within org. > Yep - thanks - it's just easy to conflate the two :-) > When you export a file, you are exporting the file > contents into a different format i.e PDF, HTML, markdown etc. By > default, code blocks are not evaluated during this process - they are > just exported 'as-is'. However, sometimes, these code blocks are used to > generate content in the file, so you do want them to be evaluated during > the export (for example, to create a 'results' section, generate an > image that is embedded in the file etc). > > So, if you 'export' your emacs init org file as PDF, it will be exported > as a PDF file where the source blocks will appear as source listings in > the PDF file along with all the other non source block text. If on the > other hand, you tangle your emacs init org file, it will create an .el > file with only the source blocks. > > Nathan Neff writes: > > > Thanks Tim - I wanted to ask the list -- what does " > > > > By default, Org does not tangle the =E2=80=98src=E2=80=99 code block on= export." mean in > > this web page:https://orgmode.org/manual/Extracting-source-code.html > > I mean, I have all of my begin_src emacs-lisp blocks with no explicit > > :tangle yesand they all are exported to the resulting *.el file. What > does > > the above statement mean? > > > > On Tue, Sep 24, 2019 at 6:14 PM Tim Cross wrote= : > > > >> > >> I just put :tangle no in the block header e.g. > >> > >> #+begin_src emacs-lisp :tangle no > >> > >> #+end_src > >> > >> This is how I turn off or remove blocks from my .emacs.d/init.el file, > >> which is tangled from an or file. You can also put a filename. This is > >> what I do for Emacs 27, which introduces the early-init.el file i.e. > >> > >> #+begin_src emacs-lisp :tangle early-init.el > >> > >> #+end_src > >> > >> #+begin_src emacs-lisp :tangle init.el > >> > >> #+end_src > >> > >> Nathan Neff writes: > >> > >> > Hello all, > >> > > >> > I use *.org files to configure my emacs and use org-babel-load-file > >> > to configure my org-mode using *.org files. Love the feature. > >> > > >> > However sometimes I'm experimenting with code blocks, and want to > simply > >> > "turn off" certain code blocks in my *.org files from being executed= . > >> > Every time > >> > I go to do this, I search the web for 30-60 minutes and I'm frustrat= ed > >> and > >> > confused by > >> > the myriad options and documentation. > >> > > >> > All I want to do is mark a source code block in my *.org files so th= at > >> the > >> > particular code block is: > >> > > >> > 1) Not exported to the resulting .el file when tangling > >> > Or > >> > 2) Not ran in the resulting .el files when tangling > >> > > >> > I recently spent 30 minutes to an hour trying to figure out how to > simply > >> > "disable" or "prevent" or "exclude" or "quit" or "don't" or "stop" o= r > >> > "please don't do this" > >> > to a code block in my *.org files. I don't want to mark the code > block > >> as > >> > "text", unless there's really no other option. > >> > > >> > In my opinion, the documentation does not simply define how to do th= is > >> > relatively common task. > >> > > >> > Can someone please point me in the right direction? Also I would be > >> > willing to submit a doc-fix or FAQ item if there is currently not an > item > >> > to do so. I'm lost and do not want to spend more time on this > seemingly > >> > easy task. > >> > > >> > Thanks, > >> > --Nate > >> > >> > >> -- > >> Tim Cross > >> > >> > > > -- > Tim Cross > --0000000000002624be059356c809 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Sep 24, 2019 at 8:19 PM Tim C= ross <theophilusx@gmail.com= > wrote:

There are two different concepts - tangling and exporting. When you
tangle the file, code blocks are written out into code files (possibly
with evaluation etc). This is part of the 'literate programming' su= pport
within org.

Yep - thanks - it's jus= t easy to conflate the two :-)


When you export a file, you are exporting the file
contents into a different format i.e PDF, HTML, markdown etc. By
default, code blocks are not evaluated during this process - they are
just exported 'as-is'. However, sometimes, these code blocks are us= ed to
generate content in the file, so you do want them to be evaluated during the export (for example, to create a 'results' section, generate an=
image that is embedded in the file etc).

So, if you 'export' your emacs init org file as PDF, it will be exp= orted
as a PDF file where the source blocks will appear as source listings in
the PDF file along with all the other non source block text. If on the
other hand, you tangle your emacs init org file, it will create an .el
file with only the source blocks.

Nathan Neff <= nathan.neff@gmail.com> writes:

> Thanks Tim - I wanted to ask the list -- what does "
>
> By default, Org does not tangle the =E2=80=98src=E2=80=99 code block o= n export." mean in
> this web page:https://orgmode.org/manual/= Extracting-source-code.html
> I mean, I have all of my begin_src emacs-lisp blocks with no explicit<= br> > :tangle yesand they all are exported to the resulting *.el file.=C2=A0= What does
> the above statement mean?
>
> On Tue, Sep 24, 2019 at 6:14 PM Tim Cross <theophilusx@gmail.com> wrote:
>
>>
>> I just put :tangle no in the block header e.g.
>>
>> #+begin_src emacs-lisp :tangle no
>>
>> #+end_src
>>
>> This is how I turn off or remove blocks from my .emacs.d/init.el f= ile,
>> which is tangled from an or file. You can also put a filename. Thi= s is
>> what I do for Emacs 27, which introduces the early-init.el file i.= e.
>>
>> #+begin_src emacs-lisp :tangle early-init.el
>>
>> #+end_src
>>
>> #+begin_src emacs-lisp :tangle init.el
>>
>> #+end_src
>>
>> Nathan Neff <nathan.neff@gmail.com> writes:
>>
>> > Hello all,
>> >
>> > I use *.org files to configure my emacs and use org-babel-loa= d-file
>> > to configure my org-mode using *.org files.=C2=A0 Love the fe= ature.
>> >
>> > However sometimes I'm experimenting with code blocks, and= want to simply
>> > "turn off" certain code blocks in my *.org files fr= om being executed.
>> > Every time
>> > I go to do this, I search the web for 30-60 minutes and I'= ;m frustrated
>> and
>> > confused by
>> > the myriad options and documentation.
>> >
>> > All I want to do is mark a source code block in my *.org file= s so that
>> the
>> > particular code block is:
>> >
>> > 1) Not exported to the resulting .el file when tangling
>> > Or
>> > 2) Not ran in the resulting .el files when tangling
>> >
>> > I recently spent 30 minutes to an hour trying to figure out h= ow to simply
>> > "disable" or "prevent" or "exclude&q= uot; or "quit" or "don't" or "stop" or >> > "please don't do this"
>> > to a code block in my *.org files.=C2=A0 I don't want to = mark the code block
>> as
>> > "text", unless there's really no other option.<= br> >> >
>> > In my opinion, the documentation does not simply define how t= o do this
>> > relatively common task.
>> >
>> > Can someone please point me in the right direction?=C2=A0 Als= o I would be
>> > willing to submit a doc-fix or FAQ item if there is currently= not an item
>> > to do so.=C2=A0 I'm lost and do not want to spend more ti= me on this seemingly
>> > easy task.
>> >
>> > Thanks,
>> > --Nate
>>
>>
>> --
>> Tim Cross
>>
>>


--
Tim Cross
--0000000000002624be059356c809--