* Org babel tangle: Don't export code @ 2019-09-24 21:18 Nathan Neff 2019-09-24 23:07 ` Tim Cross 0 siblings, 1 reply; 7+ messages in thread From: Nathan Neff @ 2019-09-24 21:18 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1267 bytes --] 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 frustrated and confused by the myriad options and documentation. All I want to do is mark a source code block in my *.org files 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 how to simply "disable" or "prevent" or "exclude" or "quit" or "don't" or "stop" or "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 this 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 [-- Attachment #2: Type: text/html, Size: 1713 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Org babel tangle: Don't export code 2019-09-24 21:18 Org babel tangle: Don't export code Nathan Neff @ 2019-09-24 23:07 ` Tim Cross 2019-09-25 0:46 ` Nathan Neff 2019-09-25 5:53 ` Ken Mankoff 0 siblings, 2 replies; 7+ messages in thread From: Tim Cross @ 2019-09-24 23:07 UTC (permalink / raw) To: emacs-orgmode 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 <nathan.neff@gmail.com> 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 frustrated and > confused by > the myriad options and documentation. > > All I want to do is mark a source code block in my *.org files 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 how to simply > "disable" or "prevent" or "exclude" or "quit" or "don't" or "stop" or > "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 this > 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Org babel tangle: Don't export code 2019-09-24 23:07 ` Tim Cross @ 2019-09-25 0:46 ` Nathan Neff 2019-09-25 1:19 ` Tim Cross 2019-09-25 5:53 ` Ken Mankoff 1 sibling, 1 reply; 7+ messages in thread From: Nathan Neff @ 2019-09-25 0:46 UTC (permalink / raw) To: Tim Cross; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2444 bytes --] Thanks Tim - I wanted to ask the list -- what does " By default, Org does not tangle the ‘src’ 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 <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 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 <nathan.neff@gmail.com> 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 frustrated > and > > confused by > > the myriad options and documentation. > > > > All I want to do is mark a source code block in my *.org files 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 how to simply > > "disable" or "prevent" or "exclude" or "quit" or "don't" or "stop" or > > "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 this > > 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 > > [-- Attachment #2: Type: text/html, Size: 3302 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Org babel tangle: Don't export code 2019-09-25 0:46 ` Nathan Neff @ 2019-09-25 1:19 ` Tim Cross 2019-09-25 1:43 ` Nathan Neff 0 siblings, 1 reply; 7+ messages in thread From: Tim Cross @ 2019-09-25 1:19 UTC (permalink / raw) To: Nathan Neff; +Cc: emacs-orgmode 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. 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 <nathan.neff@gmail.com> writes: > Thanks Tim - I wanted to ask the list -- what does " > > By default, Org does not tangle the ‘src’ 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 <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 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 <nathan.neff@gmail.com> 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 frustrated >> and >> > confused by >> > the myriad options and documentation. >> > >> > All I want to do is mark a source code block in my *.org files 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 how to simply >> > "disable" or "prevent" or "exclude" or "quit" or "don't" or "stop" or >> > "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 this >> > 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Org babel tangle: Don't export code 2019-09-25 1:19 ` Tim Cross @ 2019-09-25 1:43 ` Nathan Neff 0 siblings, 0 replies; 7+ messages in thread From: Nathan Neff @ 2019-09-25 1:43 UTC (permalink / raw) To: Tim Cross; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 3955 bytes --] On Tue, Sep 24, 2019 at 8:19 PM Tim Cross <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' 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 <nathan.neff@gmail.com> writes: > > > Thanks Tim - I wanted to ask the list -- what does " > > > > By default, Org does not tangle the ‘src’ 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 <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 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 <nathan.neff@gmail.com> 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 frustrated > >> and > >> > confused by > >> > the myriad options and documentation. > >> > > >> > All I want to do is mark a source code block in my *.org files 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 how to > simply > >> > "disable" or "prevent" or "exclude" or "quit" or "don't" or "stop" or > >> > "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 this > >> > 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 > [-- Attachment #2: Type: text/html, Size: 5608 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Org babel tangle: Don't export code 2019-09-24 23:07 ` Tim Cross 2019-09-25 0:46 ` Nathan Neff @ 2019-09-25 5:53 ` Ken Mankoff 2019-09-25 11:41 ` Nathan Neff 1 sibling, 1 reply; 7+ messages in thread From: Ken Mankoff @ 2019-09-25 5:53 UTC (permalink / raw) To: Tim Cross; +Cc: emacs-orgmode On 2019-09-25 at 01:07 +02, 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 Also, * COMMENT Section #+BEGIN_SRC # not exported because of COMMENT #+END_SRC -k. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Org babel tangle: Don't export code 2019-09-25 5:53 ` Ken Mankoff @ 2019-09-25 11:41 ` Nathan Neff 0 siblings, 0 replies; 7+ messages in thread From: Nathan Neff @ 2019-09-25 11:41 UTC (permalink / raw) To: Ken Mankoff; +Cc: Tim Cross, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1244 bytes --] On Wed, Sep 25, 2019 at 12:54 AM Ken Mankoff <mankoff@gmail.com> wrote: > > On 2019-09-25 at 01:07 +02, 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 > > Also, > > * COMMENT Section > #+BEGIN_SRC > # not exported because of COMMENT > #+END_SRC > > -k. > > Wow - sorry guys but this is really hard to understand - also I found that the following code will mess up my config - all of my *other* code blocks are *not* "tangled" and the only code block which is "tangled" is the one which I issue :tangle yes fo. #+BEGIN_SRC emacs-lisp :tangle yes (some emacs lisp here) #+END_SRC The documentation is really vague here and I did not expect it. I mean, I set :tangle no according to Tim Cross, and that's fine - the code is not tangled. Then I change it to :tangle yes and then it's the *only* block which is tangled? How could I get that from the docs here? https://orgmode.org/manual/Extracting-source-code.html I'll propose a change to the docs and submit it - I just want to know if I'm misunderstanding something about the docs or if others find that the docs could use some rephrasing (suggestions welcome). Thanks, --Nate [-- Attachment #2: Type: text/html, Size: 2137 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-09-25 11:40 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-09-24 21:18 Org babel tangle: Don't export code Nathan Neff 2019-09-24 23:07 ` Tim Cross 2019-09-25 0:46 ` Nathan Neff 2019-09-25 1:19 ` Tim Cross 2019-09-25 1:43 ` Nathan Neff 2019-09-25 5:53 ` Ken Mankoff 2019-09-25 11:41 ` Nathan Neff
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).