Re: Mistake in LaTeX syntax not detected, strange pdf generated
Same problem here -- seeing mistakes in latex/pdf generation. i On Tue, Nov 29, 2022 at 1:27 PM Dominik Schrempf wrote: > > Hi! > > I wanted to chime in here, because sometimes I do have a similar > problem. > > Whenever I export to LaTeX + PDF, it is pretty difficult to see if the > compilation actually worked (or not). This is, because the compilation > happens asynchronously, and so, the message about the compilation > results in the modeling vanishes fast. > > Usually, I open the LaTeX compilation buffer manually, but I think it > would be great if Org Mode was a bit more verbose about the result of > the compilation (not the actual export). Not sure how this would work > though... (Not very helpful, I know). > > Thank you! > Dominik > > alain.coch...@unistra.fr writes: > > > alain.coch...@unistra.fr writes on Tue 29 Nov 2022 12:33: > > > > > I would expect that the mistake be reported in the *Org PDF LaTeX > > > Output* Compilation buffer. So far, what I saw in that buffer was > > > essentially what shows up when I run 'pdflatex org_generated_file.tex' > > > from a terminal. Not this time: the "regular" pdflatex compiles > > > correctly, not the pdflatex that Org uses internally. > > > > > I thought what Org did was simply run pdflatex+bibtex+etc. just as > > > what one would do manually, but apparently there is some difference. > > > > Hum, I correct myself here: the compilation buffer does report the > > mistake (I hadn't looked at it). Also, the manual compilation with > > > >pdflatex org_generated_file.tex > > > > does generate the same pdf provided that I hit many times. > > Also, I see that the message > > > >PDF file produced with errors. > > > > appears in the *Messages* buffer. > > > > So perhaps Org could display this message in the minibuffer instead of > > > >Running /usr/bin/xdg-open /home/cochard/Org/debug3.pdf...done > > > > which leads to the impression that the compilation is OK. > -- -- A man must either resolve to point out nothing new or to become a slave to defend it. -- Sir Isaac Newton
Re: Babel C-mode corrupts double-quoted strings in output
I would advise you not to use org babel for compiled languages. There is just too much stuff that doesn't work well and multifile dependencies & build systems are just plain hard to get right. Debugging is annoying and getting org babel to tell you compiler where the source actually came from is impossible, if the language even supports #line and #file directives (Rust still doesn't). Immanuel Litzroth On Wed, Aug 31, 2022 at 6:38 PM Martin Jerabek wrote: > > Hi! > > I recently started to use Org Babel for C++ programs. One of the programs > outputs several lines with double-quoted strings, similar to this: > > #+NAME: doublequotes_cpp > #+begin_src cpp :includes :results output verbatim raw > std::cout << "\"line 1\"\n"; > std::cout << "\"line 2\"\n"; > std::cout << "\"line 3\"\n"; > #+end_src > > #+RESULTS: doublequotes_cpp > line 1 > > As you can see, only the first line is copied to the RESULTS block, and it is > stripped of the double quotes. > > I tracked down the problem to org-babel-read (in ob-core.el). > org-babel-C-execute (in ob-C.el) calls this function with the output of the > C++ program. The problem is the following line: > > ((eq (string-to-char cell) ?\") (read cell)) > > i.e. if the output of the program starts with a double quote, it is passed to > read which reads only the first string and also removes the double quotes, > resulting in the observed output. > > The original version of this piece of code was added with the following > commit: > > commit 60a8ba556d682849eafb0f84e689967cd2965549 > Author: Eric Schulte > Date: Wed Mar 2 07:55:39 2011 -0700 > > ob: read string variable values wrapped in double quotes, removing the > quotes > > * lisp/ob.el (org-babel-read): Read string variable values wrapped in > double quotes, removing the quotes. > > AFAICT this modification was done in response to the email thread "[Orgmode] > org-babel-read should have option NOT to interpret as elisp" started on > 2011-02-27, more specifically the email on "Wed, 02 Mar 2011 07:56:45 -0700" > from Eric Schulte. This was obviously done for parsing variables in the > header line, not for the program output, but the Babel C mode uses > org-babel-read also for the output. > > I assumed that ":results output verbatim raw" would prevent any > postprocessing of the output but this is not the case for C mode. > > I am not sure how to fix this without breaking backward compatibility. I > assume it should be fixed directly in org-babel-C-execute, not in a central > function like org-babel-read to minimize the impact. Surprisingly (for me) > the equivalent shell script works as expected: > > #+NAME: doublequotes > #+begin_src shell :results output verbatim raw > echo '"line 1"' > echo '"line 2"' > echo '"line 3"' > #+end_src > > #+RESULTS: doublequotes > "line 1" > "line 2" > "line 3" > > because org-babel-execute:shell does not process the output with > org-babel-read. I do not know if languages other than the C family (C, C++, > D) are affected. > > At the very least, the documentation of org-babel-read should be expanded to > document the fact that if the CELL parameter starts with a double quote, it > is processed by the read function. > > Best regards > Martin Jerabek > -- -- A man must either resolve to point out nothing new or to become a slave to defend it. -- Sir Isaac Newton
Re: Moving to a literate file for .emacs
It's possible to let tangling generate comments that will link back to the literate file where you defined the function. https://orgmode.org/manual/Extracting-Source-Code.html See the comment header arg. Then you could advise the relevant functions that do emacs function lookup to check whether there's such a "link comment" near the definition and jump to that instead. All this is rather hackish and I stopped doing my init files in literate org. Immanuel On Mon, Jul 4, 2022 at 4:07 PM Stephen Eglen wrote: > > I see many users are switching to using a 'literate programming' > approach to tangling their .emacs file from an org file. > > Has anyone solved the following problem though? If I have a file called > config.org containing: > > * test > > #+begin_src emacs-lisp > (defun quick-test () > "interactive" > (* 3 9) > ) > #+end_src > > > and then in my .emacs file I do: > > (org-babel-load-file "~/config.org") > > quick-test is indeed defined, but when I do C-c f RET quick-test RET it > takes me to config.el (a tangled file, suitable for computers, not > humans), rather than config.org. Is it possible instead to get the > editor to jump to the definition in config.org? > > Stephen > > -- -- A man must either resolve to point out nothing new or to become a slave to defend it. -- Sir Isaac Newton
Re:
Just going by what I see, not having tried it: (setq haskell-process-args-stack-ghci (list "--ghci-options" "-XFlexibleContexts")) In your version the process gets 1 argument (with a space in it). In my version it gets 2 args. Immanuel On Thu, Jan 20, 2022 at 8:22 PM Roger Mason wrote: > > Hello, > > I want to run stack ghci from haskell blocks in org-mode. For the > task at I need to start ghci with command line option > -XFlexibleContexts. I have this in my org-mode buffer: > > #+begin_src emacs-lisp :results none > (setq haskell-process-type 'stack-ghci) > (setq haskell-process-args-stack-ghci (list "--ghci-options > -XFlexibleContexts")) > #+end_src > > but I get > > Process haskell exited abnormally with code 1 > Invalid option `--ghci-options -XFlexibleContexts' > > in the inferior haskell buffer. > > Does anyone know how to do what I want? > > Thanks, > Roger > -- -- A man must either resolve to point out nothing new or to become a slave to defend it. -- Sir Isaac Newton
Re: noweb and shell heredocs
You can set the delimiters used for noweb code. org-babel-noweb-wrap-end and org-babel-noweb-wrap-end. I think I set them to @@ in shell code. Immanuel On Thu, Nov 25, 2021 at 7:41 PM Łukasz Stelmach wrote: > > Hi, > > Is there anything I may try to stop shell syntax hihgliting in code > blocks being fooled by noweb refs? > > -- > Kind regards, > Łukasz Stelmach -- -- A man must either resolve to point out nothing new or to become a slave to defend it. -- Sir Isaac Newton
Re: noweb syntax clashing with shell here document syntax
You can choose which delimiters signal noweb. see the documentation of org-babel-noweb-wrap-start and org-babel-noweb-wrap-end. Immanuel On Mon, Mar 22, 2021 at 5:35 PM Sebastian Miele wrote: > > Hello! > > The noweb syntax seems to clash with the syntax of here documents in > shell scripts. In the block like > > #+BEGIN_SRC shell :noweb yes > echo a > <> > echo b > #+END_SRC > > everything following the line with the the noweb reference does not > get fontified properly. I suspect that the problem already is known > for a long time. Is that true? If yes, what is the status of this > issue? Is there a known workaround? > > At least in ZSH it may very well be the case that a line ending with > '>>' never is valid, except in cases where something like an '< before it is not an opening of a here document. So it possibly is > something that could be fixed in sh-script.el. But I do not know > exactly. > > Anybody who already knows more about this? > > Best wishes > Sebastian > -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: ist here a :post header arg for tangling?
I also seem to remember that the buffer you are dropped into after tangling doesn't even have the correct major mode set. Immanuel On Mon, Jan 4, 2021 at 4:11 PM Diego Zamboni wrote: > > Agree. It should be possible to make the hook file-local, but still it's not > trivial to have good control over where and how the changes are made. > > --Diego > > > On Mon, Jan 4, 2021 at 3:51 PM Immanuel Litzroth > wrote: >> >> There's that, but you're not gonna do much with that since it is >> global to emacs. If you're brimming >> with vigour you might achieve what you want by rebinding that each >> time you tangle to do the correct >> thing. Not much information is available in that hook, you get dropped >> into a temp buffer containing the >> result of tangling. >> Immanuel >> >> On Mon, Jan 4, 2021 at 3:07 PM Diego Zamboni wrote: >> > >> > There's =org-babel-post-tangle-hook=, which AFAICT specifies hooks that >> > will be run with the tangled code in a temporary buffer. I couldn't find >> > much documentation nor examples, but it is mentioned at >> > https://orgmode.org/manual/Extracting-Source-Code.html#Hooks-3 >> > >> > --Diego >> > >> > >> > >> > >> > >> > On Fri, Jan 1, 2021 at 1:31 PM Immanuel Litzroth >> > wrote: >> >> >> >> I don't think there is an arg for that. I have written a tangler that >> >> reuses a lot >> >> of the org-babel machinery and has a more flexible mechanism to decide >> >> what >> >> to do with the tangled code -- I use it for example to not write a >> >> tangled file if it >> >> hasn't changed, meaning that it will not trigger recompile. >> >> The project is private now but if you're interested I can give you access >> >> to it. >> >> What exactly are you trying to do? >> >> Immanuel >> >> >> >> On Fri, Jan 1, 2021 at 2:09 AM George Mauer wrote: >> >> > >> >> > I'd like to run some code to post-process files after they are tangled. >> >> > Is there a header-arg for that? >> >> >> >> >> >> >> >> -- >> >> -- Researching the dual problem of finding the function that has a >> >> given point as fixpoint. >> >> >> >> >> -- >> -- Researching the dual problem of finding the function that has a >> given point as fixpoint. -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: ist here a :post header arg for tangling?
Oh and I also made the tangling itself more flexible in that you can now also choose to only tangle stuff going to a certain file. This is mainly to be able to define an interactive command that tangles/reloads everything going to the file under point. Immanuel On Mon, Jan 4, 2021 at 4:31 PM Immanuel Litzroth wrote: > > Well I solved the problem by writing a tangler which can be configured > with tangle-config > you define a tangler by making a hash "language" -> tangle-hooks. The > tangle-hooks are > called at beginning of tangling, on each source block, on each > noweb-ref and at the end of > tangling. They receive the full source-block-info to do their work, > and in the case of noweb-references > they receive the full stack of sbi's that lead up to this noweb reference. > >>> > (tangled-buffer "Buffer that is being tangled") > (name "Name of the code block") > (tangle-file "Filename to tangle to") > (properties "Properties of this block") > (full-block "Text of the full block") > (beg-block "Buffer pos of beginning of the block in the tangled buffer") > (end-block "end of the block in the tangled buffer") > (lang "language of the tangled buffer") > (beg-lang "beginning of the language in the tangled buffer") > (end-lang "end of the language in the tangled buffer") > (switches "switches of this block") > (beg-switches "begin of the switches in this block") > (end-switches "end of the switches in this block") > (header-args "header args of this block") > (beg-header-args "buffer pos of header args beginning") > (end-header-args "buffer pos of header args end") > (body "body of the tangled block") > (beg-body "buffer pos of the beginning of the body") > (end-body "buffer pos of the end of the body")) > >>> > That way I can tangle a multi language org file and do the correct thing for > each of the language by defining functions of interest. It's quite > flexible, I'm > going to use it to do some aspect-oriented programming/tangling when I > find the time. > Immanuel > > On Mon, Jan 4, 2021 at 4:11 PM Diego Zamboni wrote: > > > > Agree. It should be possible to make the hook file-local, but still it's > > not trivial to have good control over where and how the changes are made. > > > > --Diego > > > > > > On Mon, Jan 4, 2021 at 3:51 PM Immanuel Litzroth > > wrote: > >> > >> There's that, but you're not gonna do much with that since it is > >> global to emacs. If you're brimming > >> with vigour you might achieve what you want by rebinding that each > >> time you tangle to do the correct > >> thing. Not much information is available in that hook, you get dropped > >> into a temp buffer containing the > >> result of tangling. > >> Immanuel > >> > >> On Mon, Jan 4, 2021 at 3:07 PM Diego Zamboni wrote: > >> > > >> > There's =org-babel-post-tangle-hook=, which AFAICT specifies hooks that > >> > will be run with the tangled code in a temporary buffer. I couldn't find > >> > much documentation nor examples, but it is mentioned at > >> > https://orgmode.org/manual/Extracting-Source-Code.html#Hooks-3 > >> > > >> > --Diego > >> > > >> > > >> > > >> > > >> > > >> > On Fri, Jan 1, 2021 at 1:31 PM Immanuel Litzroth > >> > wrote: > >> >> > >> >> I don't think there is an arg for that. I have written a tangler that > >> >> reuses a lot > >> >> of the org-babel machinery and has a more flexible mechanism to decide > >> >> what > >> >> to do with the tangled code -- I use it for example to not write a > >> >> tangled file if it > >> >> hasn't changed, meaning that it will not trigger recompile. > >> >> The project is private now but if you're interested I can give you > >> >> access to it. > >> >> What exactly are you trying to do? > >> >> Immanuel > >> >> > >> >> On Fri, Jan 1, 2021 at 2:09 AM George Mauer wrote: > >> >> > > >> >> > I'd like to run some code to post-process files after they are > >> >> > tangled. Is there a header-arg for that? > >> >> > >> >> > >> >> > >> >> -- > >> >> -- Researching the dual problem of finding the function that has a > >> >> given point as fixpoint. > >> >> > >> > >> > >> -- > >> -- Researching the dual problem of finding the function that has a > >> given point as fixpoint. > > > > -- > -- Researching the dual problem of finding the function that has a > given point as fixpoint. -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: ist here a :post header arg for tangling?
Well I solved the problem by writing a tangler which can be configured with tangle-config you define a tangler by making a hash "language" -> tangle-hooks. The tangle-hooks are called at beginning of tangling, on each source block, on each noweb-ref and at the end of tangling. They receive the full source-block-info to do their work, and in the case of noweb-references they receive the full stack of sbi's that lead up to this noweb reference. >>> (tangled-buffer "Buffer that is being tangled") (name "Name of the code block") (tangle-file "Filename to tangle to") (properties "Properties of this block") (full-block "Text of the full block") (beg-block "Buffer pos of beginning of the block in the tangled buffer") (end-block "end of the block in the tangled buffer") (lang "language of the tangled buffer") (beg-lang "beginning of the language in the tangled buffer") (end-lang "end of the language in the tangled buffer") (switches "switches of this block") (beg-switches "begin of the switches in this block") (end-switches "end of the switches in this block") (header-args "header args of this block") (beg-header-args "buffer pos of header args beginning") (end-header-args "buffer pos of header args end") (body "body of the tangled block") (beg-body "buffer pos of the beginning of the body") (end-body "buffer pos of the end of the body")) >>> That way I can tangle a multi language org file and do the correct thing for each of the language by defining functions of interest. It's quite flexible, I'm going to use it to do some aspect-oriented programming/tangling when I find the time. Immanuel On Mon, Jan 4, 2021 at 4:11 PM Diego Zamboni wrote: > > Agree. It should be possible to make the hook file-local, but still it's not > trivial to have good control over where and how the changes are made. > > --Diego > > > On Mon, Jan 4, 2021 at 3:51 PM Immanuel Litzroth > wrote: >> >> There's that, but you're not gonna do much with that since it is >> global to emacs. If you're brimming >> with vigour you might achieve what you want by rebinding that each >> time you tangle to do the correct >> thing. Not much information is available in that hook, you get dropped >> into a temp buffer containing the >> result of tangling. >> Immanuel >> >> On Mon, Jan 4, 2021 at 3:07 PM Diego Zamboni wrote: >> > >> > There's =org-babel-post-tangle-hook=, which AFAICT specifies hooks that >> > will be run with the tangled code in a temporary buffer. I couldn't find >> > much documentation nor examples, but it is mentioned at >> > https://orgmode.org/manual/Extracting-Source-Code.html#Hooks-3 >> > >> > --Diego >> > >> > >> > >> > >> > >> > On Fri, Jan 1, 2021 at 1:31 PM Immanuel Litzroth >> > wrote: >> >> >> >> I don't think there is an arg for that. I have written a tangler that >> >> reuses a lot >> >> of the org-babel machinery and has a more flexible mechanism to decide >> >> what >> >> to do with the tangled code -- I use it for example to not write a >> >> tangled file if it >> >> hasn't changed, meaning that it will not trigger recompile. >> >> The project is private now but if you're interested I can give you access >> >> to it. >> >> What exactly are you trying to do? >> >> Immanuel >> >> >> >> On Fri, Jan 1, 2021 at 2:09 AM George Mauer wrote: >> >> > >> >> > I'd like to run some code to post-process files after they are tangled. >> >> > Is there a header-arg for that? >> >> >> >> >> >> >> >> -- >> >> -- Researching the dual problem of finding the function that has a >> >> given point as fixpoint. >> >> >> >> >> -- >> -- Researching the dual problem of finding the function that has a >> given point as fixpoint. -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: ist here a :post header arg for tangling?
There's that, but you're not gonna do much with that since it is global to emacs. If you're brimming with vigour you might achieve what you want by rebinding that each time you tangle to do the correct thing. Not much information is available in that hook, you get dropped into a temp buffer containing the result of tangling. Immanuel On Mon, Jan 4, 2021 at 3:07 PM Diego Zamboni wrote: > > There's =org-babel-post-tangle-hook=, which AFAICT specifies hooks that will > be run with the tangled code in a temporary buffer. I couldn't find much > documentation nor examples, but it is mentioned at > https://orgmode.org/manual/Extracting-Source-Code.html#Hooks-3 > > --Diego > > > > > > On Fri, Jan 1, 2021 at 1:31 PM Immanuel Litzroth > wrote: >> >> I don't think there is an arg for that. I have written a tangler that >> reuses a lot >> of the org-babel machinery and has a more flexible mechanism to decide what >> to do with the tangled code -- I use it for example to not write a >> tangled file if it >> hasn't changed, meaning that it will not trigger recompile. >> The project is private now but if you're interested I can give you access to >> it. >> What exactly are you trying to do? >> Immanuel >> >> On Fri, Jan 1, 2021 at 2:09 AM George Mauer wrote: >> > >> > I'd like to run some code to post-process files after they are tangled. Is >> > there a header-arg for that? >> >> >> >> -- >> -- Researching the dual problem of finding the function that has a >> given point as fixpoint. >> -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: ist here a :post header arg for tangling?
I don't think there is an arg for that. I have written a tangler that reuses a lot of the org-babel machinery and has a more flexible mechanism to decide what to do with the tangled code -- I use it for example to not write a tangled file if it hasn't changed, meaning that it will not trigger recompile. The project is private now but if you're interested I can give you access to it. What exactly are you trying to do? Immanuel On Fri, Jan 1, 2021 at 2:09 AM George Mauer wrote: > > I'd like to run some code to post-process files after they are tangled. Is > there a header-arg for that? -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: Unhealthy Haskell babel
Well another possible solution is to wrap the code blocks in :{ xxx :} in (defun org-babel-execute:haskell (body params) -- ob-haskell.el Immanuel On Thu, Dec 10, 2020 at 6:21 PM Lawrence Bottorff wrote: > > I see your point, i.e., compiled, multi-file projects are not really meant > for the REPL-dominant world of org-mode babel. Babel's sweet-spot would be > the interpreted world, the very best probably a Lisp language. Still, the > ability to add code to a running REPL should be possible. As I mentioned, SML > is a sibling of Haskell and its babel implementation worked fine for me as I > worked through an SML course. So yes, this appears to be a Haskell REPL > issue. I'm just a beginner with Haskell, and all my intro texts start you out > using the ghci REPL interactively. But then they switch you over to a text > file compiled in the REPL with :l myfile.hs . . . no explanation as to why > you can't just continue with the REPL putting the program in line-by-line. > The fact that I can use the :set +m to include multiple lines of code, but > cannot do a type definition is rather bizarre, though. This is a decision > Haskell made with their REPL and babel really can't do much about it, I > suppose. The Haskell .lhs literate option is interesting. Yes, I'd like to > see your tangle option, please. > > On Thu, Dec 10, 2020 at 4:28 AM Immanuel Litzroth > wrote: >> >> I don't think org-babel is a good fit for compiled languages. If the >> idea is to just take 1 snippet, >> and "execute" that it means that to have a consistent whole you'd need >> to put all the modules of >> your program into that snippet (already impossible in Haskell, you can >> have only 1 module per file), >> compile that, run the resulting binary. Or org mode would have to have >> some idea of what needs to >> be retangled & rebuilt. >> I think that using org-babel for compiled, multifile languages will >> only work in very simple cases -- and >> even then.. -- but will lead to problems very soon. >> Immanuel >> >> On Thu, Dec 10, 2020 at 4:21 AM Lawrence Bottorff wrote: >> > >> > I'm looking into Haskell (latest ghci) again on org-mode. This >> > >> > #+begin_src haskell :results verbatim :exports both >> > :set +m >> > doubleSmallNumber x = if x > 100 >> > then x >> > else x*2 >> > #+end_src >> > >> > works, but still the :set +m is necessary for it to see the whole. But this >> > >> > #+begin_src haskell :results verbatim :exports both >> > :set +m >> > factorial :: Int -> Int >> > factorial 0 = 1 >> > factorial n = n * factorial (n - 1) >> > #+end_src >> > >> > results in this on the REPL side: >> > >> > Prelude> :set +m >> > factorial :: Int -> Int >> > factorial 0 = 1 >> > factorial n = n * factorial (n - 1) >> > "org-babel-haskell-eoe" >> > Prelude> >> > :26:1-23: error: >> > • No instance for (Show (Int -> Int)) arising from a use of ‘print’ >> > (maybe you haven't applied a function to enough arguments?) >> > • In a stmt of an interactive GHCi command: print it >> > Prelude> Prelude> Prelude> "org-babel-haskell-eoe" >> > >> > which is the same behavior if I try to feed the program into the REPL one >> > line at a time, i.e., >> > >> > Prelude> factorial :: Int -> Int >> > >> > :40:1-23: error: >> > • No instance for (Show (Int -> Int)) arising from a use of ‘print’ >> > (maybe you haven't applied a function to enough arguments?) >> > • In a stmt of an interactive GHCi command: print it >> > >> > So the :set +m trick (take multiple lines) doesn't help here. Obviously, >> > Haskell is not ready to be used with Babel. Can it be fixed? BTW, this >> > does work with the regular ghci REPL and haskell-mode. If it helps, >> > Standard ML, which has very similar syntax (it was Haskell's parent), >> > works fine. >> > >> > LB >> >> >> >> -- >> -- Researching the dual problem of finding the function that has a >> given point as fixpoint. -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: Unhealthy Haskell babel
I don't think org-babel is a good fit for compiled languages. If the idea is to just take 1 snippet, and "execute" that it means that to have a consistent whole you'd need to put all the modules of your program into that snippet (already impossible in Haskell, you can have only 1 module per file), compile that, run the resulting binary. Or org mode would have to have some idea of what needs to be retangled & rebuilt. I think that using org-babel for compiled, multifile languages will only work in very simple cases -- and even then.. -- but will lead to problems very soon. Immanuel On Thu, Dec 10, 2020 at 4:21 AM Lawrence Bottorff wrote: > > I'm looking into Haskell (latest ghci) again on org-mode. This > > #+begin_src haskell :results verbatim :exports both > :set +m > doubleSmallNumber x = if x > 100 > then x > else x*2 > #+end_src > > works, but still the :set +m is necessary for it to see the whole. But this > > #+begin_src haskell :results verbatim :exports both > :set +m > factorial :: Int -> Int > factorial 0 = 1 > factorial n = n * factorial (n - 1) > #+end_src > > results in this on the REPL side: > > Prelude> :set +m > factorial :: Int -> Int > factorial 0 = 1 > factorial n = n * factorial (n - 1) > "org-babel-haskell-eoe" > Prelude> > :26:1-23: error: > • No instance for (Show (Int -> Int)) arising from a use of ‘print’ > (maybe you haven't applied a function to enough arguments?) > • In a stmt of an interactive GHCi command: print it > Prelude> Prelude> Prelude> "org-babel-haskell-eoe" > > which is the same behavior if I try to feed the program into the REPL one > line at a time, i.e., > > Prelude> factorial :: Int -> Int > > :40:1-23: error: > • No instance for (Show (Int -> Int)) arising from a use of ‘print’ > (maybe you haven't applied a function to enough arguments?) > • In a stmt of an interactive GHCi command: print it > > So the :set +m trick (take multiple lines) doesn't help here. Obviously, > Haskell is not ready to be used with Babel. Can it be fixed? BTW, this does > work with the regular ghci REPL and haskell-mode. If it helps, Standard ML, > which has very similar syntax (it was Haskell's parent), works fine. > > LB -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: buggy plantuml function
There is a solution in all source blocks that would have a problem because there is a * at the beginning of a line. Just prepend it with ,. So this works over here: #+BEGIN_SRC plantuml :file test.png @startmindmap ,* Debian ,** Ubuntu ,*** Linux Mint ,*** Kubuntu ,*** Lubuntu ,*** KDE Neon ,** LMDE ,** SolydXK ,** SteamOS ,** Raspbian with a very long name ,*** Raspmbc => OSMC ,*** Raspyfi => Volumio @endmind #+END_SRC Of course I also had to change org-babel-plantuml-make-body (defun org-babel-plantuml-make-body (body _) body) to make that work with "C-c C-c". Weren't there supposed to be maintainers for this stuff? Has no plantuml maintainer been found? Immanuel On Mon, Nov 23, 2020 at 11:28 AM Heinz Tuechler wrote: > > Immanuel Litzroth wrote/hat geschrieben on/am 15.11.2020 13:27: > > (defun org-babel-plantuml-make-body (body params) > > "Return PlantUML input string. > > > > BODY is the content of the source block and PARAMS is a property list > > of source block parameters. This function relies on the > > `org-babel-expand-body:generic' function to extract `:var' entries > > from PARAMS and on the `org-babel-variable-assignments:plantuml' > > function to convert variables to PlantUML assignments. > > > > If BODY does not contain @startXXX ... @endXXX clauses, @startuml > > ... @enduml will be added." > > (let ((assignments (org-babel-variable-assignments:plantuml params))) > > (if (string-prefix-p "@start" body t) assignments > > (format "@startuml\n%s\n@enduml" > > (org-babel-expand-body:generic body params assignments) > > > > expands to assignments if the body starts with @startmindmap? > > Immanuel > > > > Dear Immanuel, > > did you ever receive an answer to your post? I ask, because I am > curious, if you were able to use mindmap in a #+BEGIN_SRC plantuml / > #+END_SRC block? For me it was not possible with *, because they get > interpreted as org headlines and break the SRC block. > > best regards, > > Heinz > -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
buggy plantuml function
(defun org-babel-plantuml-make-body (body params) "Return PlantUML input string. BODY is the content of the source block and PARAMS is a property list of source block parameters. This function relies on the `org-babel-expand-body:generic' function to extract `:var' entries from PARAMS and on the `org-babel-variable-assignments:plantuml' function to convert variables to PlantUML assignments. If BODY does not contain @startXXX ... @endXXX clauses, @startuml ... @enduml will be added." (let ((assignments (org-babel-variable-assignments:plantuml params))) (if (string-prefix-p "@start" body t) assignments (format "@startuml\n%s\n@enduml" (org-babel-expand-body:generic body params assignments) expands to assignments if the body starts with @startmindmap? Immanuel -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: best practices query: non-emacs packages based on tangled source
I think the org way of tangling just doesn't work well for compiled languages. Here are some reasons: - Not possible to tangle all code going to a specified file - Not possible to add line directives without major surgery - Not all language modes do the correct thing - No way to prevent overwriting an unchanged file - Special casing e.g. Don’t tangle to a file called ‘no’. Specific gripe: - :prologue and :epilogue are not honoured by all modes >>> #+ BEGIN_SRC emacs-lisp :prologue "hello" :epilogue "goodbye" :tangle ex1.el (+ 1 2) #+ END_SRC #+ BEGIN_SRC haskell :tangle ex1.hs :prologue "hello" :epilogue "goodbye" hey #+ END_SRC hey #+HEADER: :tangle ex1.cpp #+ BEGIN_SRC cpp :prologue "hello" :epilogue "goodbye" main() {} #+ END_SRC #+ BEGIN_SRC bash :tangle ex1.bash :prologue "hello" :epilogue "goodbye" aha #+ END_SRC >>> Based on the org machinery I've written a simple tangler which addresses some of these shortcomings. It can add line directives to recursively expanded noweb references -- and get that right. It can also take any action at the end of tangling like comparing your tangled file to the one on disk and not overwrite if it's the same, or just sending your tangled buffer to an interpreter not writing it to file (remember that error references point back to the .org file). Also it can tangle all blocks going to the same file. This has been tested for Haskell, C++ and elisp. It's in a private repo on github because it's not ready for release yet, but if someone is interested I can give them access. Immanuel On Tue, Oct 27, 2020 at 11:30 PM Dr. Arne Babenhauserheide wrote: > > > TRS-80 writes: > > > Therefore, any stuff I plan on releasing publicly, I do not do in > > literate style (JMHO). However if you are dead set on doing literate > > paradigm, then maybe my experience is invalid for your use-case. > > My experience is that literate style works very well for tutorials, but > whenever I developed a larger program within org-mode, I tangled it once > I had to start debugging and then kept it as separate source. > > Once the code becomes complex, I want to stay in one programming > language without outside features that also add extra complexity. > > That said, for simple code the additional freedom of multi-language > programming in org-mode is awesome. I’m using that to create random > roleplaying characters directly from random tables in org-mode, with > those tables being the primary source (because the book is the most > important product, not the code). > > Best wishes, > Arne > -- > Unpolitisch sein > heißt politisch sein > ohne es zu merken -- -- Researching the dual problem of finding the function that has a given point as fixpoint.
Re: [O] Bug: org-edit-src keeps splitting the window [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)]
You want me to do that and send a new patch or are you going to do it after you apply the patch? Regards, Immanuel On Mon, Sep 2, 2019 at 9:41 PM Nicolas Goaziou wrote: > > Hello, > > immanuel writes: > > > When org-edit-src-code is called with org-window-setup equal to > > 'split-window-below or 'split-window-right it will keep splitting the > > window if the mouse is clicked on the src block in the org buffer. > > This patch tries to address that > > [...] > > > +(defun org-src-select-window-for-buffer (buffer split-fun) > > You should make it an internal function: `org-src--select-window-for-buffer'. > > > + "Tries to select an existing window for buffer or splits the > > window." > > You need to expound the docstring a bit, e.g.: > > "Re-use an existing window or split the current window. > If BUFFER is current in a window, use it. Otherwise, split the current > window, according to SPLIT-FUN, in order to display it. > > Also, I think this should be notified in ORG-NEWS file. > > Thank you! > > Regards, > > -- > Nicolas Goaziou
Re: [O] Bug: tangling with elisp as lang in a noweb reference doesn't work [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/)]
No problem! I have some more coming up :-) I've been looking at getting org-babel to add line directives for languages that support it. (c, c++, haskell...). It would make literate programming for these kinds of languages much better, and other people have been complaining e.g. https://paulbatchelor.github.io/blog/posts/2018-09-21-org-babel-impressions.html Unfortunately there is no easy way to hook this into org-babel now without doing some rather intrusive work. 1) The language specific expansions don't know the file or the line a block comes from, and noweb references have already been expanded. 2) The tangle-body-hook is useless since it runs in a temp buffer that doesn't even have the major mode set for the language you're tangling to. 3) The :comments mechanism is not strong enough to allow language specific comments and it 's different for noweb vs. normal block expansion. Would there be interest in such a feature, if it doesn't change current behaviour? Immanuel On Fri, Aug 30, 2019 at 11:37 PM Nicolas Goaziou wrote: > > Hello, > > immanuel writes: > > > #+NAME: this is a test > > #+BEGIN_SRC elisp :tangle no > > > > (message \"aha\") #+END_SRC > > > > #+BEGIN_SRC elisp :noweb yes :comments noweb :tangle out.el > > first > > <> > > second > > #+END_SRC > > > > #+BEGIN_SRC elisp :tangle no > > (progn > > (org-babel-tangle) > > (with-temp-buffer > > (insert-file-contents "out.el") > > (buffer-string) > > #+END_SRC > > > > > > Doesn't work. The reason is that the function > > org-babel-expand-noweb-references uses > > > > #+BEGIN_SRC emacs-lisp > > (c-wrap (lambda (text) > > (with-temp-buffer > > (funcall (intern (concat lang "-mode"))) > > ... > > #+END_SRC > > Fixed! Thank you for the report and the analysis. > > Regards, > > -- > Nicolas Goaziou
[O] Bug: org-babel-tangle-clean seems buggy [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)]
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. When running 'org-babel-tangle-clean on this buffer: >> [[file:foo][something]] <> [[file:bar][something else]] <> >> I get >> <> >> Given the code of that function -- especially the (while (or -- it's highly unlikely that that code does what the docstring says it does. I'm also not clear on why you'd want to remove noweb references. #+BEGIN_SRC emacs-lisp (defun org-babel-tangle-clean () "Remove comments inserted by `org-babel-tangle'. Call this function inside of a source-code file generated by `org-babel-tangle' to remove all comments inserted automatically by `org-babel-tangle'. Warning, this comment removes any lines containing constructs which resemble Org file links or noweb references." (interactive) (goto-char (point-min)) (while (or (re-search-forward "\\[\\[file:.*\\]\\[.*\\]\\]" nil t) (re-search-forward (org-babel-noweb-wrap) nil t)) (delete-region (save-excursion (beginning-of-line 1) (point)) (save-excursion (end-of-line 1) (forward-char 1) (point) #END_SRC Immanuel Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-07-17 Package: Org mode version 9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-link-shell-confirm-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-odt-format-headline-function 'org-odt-format-headline-default-function org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-mode-hook '((closure (org-agenda-skip-regexp org-table1-hline-regexp org-table-tab-recognizes-table\.el org-table-dataline-regexp org-table-any-border-regexp org-agenda-restriction-lock-overlay org-agenda-overriding-restriction org-agenda-diary-file org-complex-heading-regexp calendar-mode-map t) nil (setq imenu-create-index-function (quote org-imenu-get-tree))) (closure (org--rds reftex-docstruct-symbol org-element-greater-elements org-clock-history org-agenda-current-date org-with-time org-defdecode org-def org-read-date-inactive org-ans2 org-ans1 org-columns-current-fmt-compiled org-clock-current-task org-clock-effort org-agenda-skip-function org-agenda-skip-comment-trees org-agenda-archives-mode org-end-time-was-given org-time-was-given org-log-note-extra org-log-note-purpose org-log-post-message org-last-inserted-timestamp org-last-changed-timestamp org-entry-property-inherited-from org-blocked-by-checkboxes org-state org-agenda-headline-snapshot-before-repeat org-capture-last-stored-marker org-agenda-start-on-weekday org-agenda-buffer-tmp-name org-priority-regexp org-mode-abbrev-table org-mode-syntax-table buffer-face-mode-face org-tbl-menu org-org-menu org-struct-menu org-entities org-last-state org-id-track-globally org-clock-start-time texmathp-why remember-data-file org-agenda-tags-todo-honor-ignore-options iswitchb-temp-buflist align-mode-rules-list org-emphasis-alist org-emphasis-regexp-components org-export-registered-backends org-modules org-babel-load-languages org-indent-indentation-per-level org-element-paragraph-separate ffap-url-regexp org-inlinetask-min-level t) nil (add-hook (quote change-major-mode-hook) (quote org-show-all) (quote append) (quote local))) (closure (org-src-window-setup *this* org-babel-confirm-evaluate-answer-no org-src-preserve-indentation org-src-lang-modes org-link-file-path-type org-edit-src-content-indentation org-babel-library-of-babel t) nil (add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all) (quote append) (quote local))) org-babel-result-hide-spec org-babel-hide-all-hashes auto-fill-mode) org-odt-format-drawer-function '(closure (hfy-user-sheet-assoc hfy-html-quote-regex hfy-html-quote-map hfy-face-to-css hfy-begin-span-handler hfy-end-span-handler archive-zip-extract nxml-auto-insert-xml-declaration-flag t) (_name contents) contents) org-arch
[O] Bug: org-edit-src keeps splitting the window [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)]
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. When org-edit-src-code is called with org-window-setup equal to 'split-window-below or 'split-window-right it will keep splitting the window if the mouse is clicked on the src block in the org buffer. This patch tries to address that diff --git a/lisp/org-src.el b/lisp/org-src.el index 9134d5b5d..c7e201687 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -786,6 +786,13 @@ Raise an error when current buffer is not a source editing buffer." (unless (org-src-edit-buffer-p) (error "Not in a source buffer")) org-src--source-type) +(defun org-src-select-window-for-buffer (buffer split-fun) + "Tries to select an existing window for buffer or splits the window." + (select-window + (or +(display-buffer-reuse-window buffer '()) +(funcall split-fun + (defun org-src-switch-to-buffer (buffer context) (pcase org-src-window-setup (`current-window (pop-to-buffer-same-window buffer)) @@ -794,12 +801,12 @@ Raise an error when current buffer is not a source editing buffer." (`split-window-below (if (eq context 'exit) (delete-window) - (select-window (split-window-vertically))) + (org-src-select-window-for-buffer buffer #'split-window-vertically)) (pop-to-buffer-same-window buffer)) (`split-window-right (if (eq context 'exit) (delete-window) - (select-window (split-window-horizontally))) + (org-src-select-window-for-buffer buffer #'split-window-horizontally)) (pop-to-buffer-same-window buffer)) (`other-frame (pcase context Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-07-17 Package: Org mode version 9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-link-shell-confirm-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-reveal-start-hook '(org-decrypt-entry) org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function org-imenu-get-tree] 2] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes auto-fill-mode) org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((emacs-lisp . t) (C) (python . t) (shell . t) (plantuml . t)) org-src-preserve-indentation t org-occur-hook '(org-first-headline-recenter) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-babel-tangle-lang-exts '(("D" . "d") ("C++" . "cpp") ("abc" . "abc") ("asymptote" . "asy") ("awk" . "awk") ("clojure" . "clj") ("fortran" . "F90") ("groovy" . "groovy") ("haskell" . "hs") ("io" . "io") ("java" . "java") ("latex" . "tex") ("LilyPond" . "ly") ("lisp" . "lisp") ("lua" . "lua") ("maxima" . "max") ("ocaml" . "ml") ("perl" . "pl") ("picolisp" . "l") ("processing" . "pde") ("ruby" . "rb") ("sed" . "sed") ("vala" . "vala") ("python" . "py") ("emacs-lisp" . "el") ("elisp" . "el")) org-confirm-shell-link-function 'yes-or-no-p org-link-parameters '(("attachment" :follow org-attach-open-link :export org-attach-export-link :complete org-attach-complete-link)
[O] Bug: tangling with elisp as lang in a noweb reference doesn't work [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/)]
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. #+NAME: this is a test #+BEGIN_SRC elisp :tangle no (message \"aha\") #+END_SRC #+BEGIN_SRC elisp :noweb yes :comments noweb :tangle out.el first <> second #+END_SRC #+BEGIN_SRC elisp :tangle no (progn (org-babel-tangle) (with-temp-buffer (insert-file-contents "out.el") (buffer-string) #+END_SRC Doesn't work. The reason is that the function org-babel-expand-noweb-references uses #+BEGIN_SRC emacs-lisp (c-wrap (lambda (text) (with-temp-buffer (funcall (intern (concat lang "-mode"))) ... #+END_SRC Instead of the possibly more correct turning on of the major mode that is found in org-babel-tangle: #+BEGIN_SRC emacs-lisp (lang-f (intern (concat (or (and (cdr (assoc lang org-src-lang-modes)) (symbol-name (cdr (assoc lang org-src-lang-modes lang) "-mode"))) #+END_SRC Immanuel Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-07-17 Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook '(org-clock-out-if-current) org-latex-listings t org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-odt-format-headline-function 'org-odt-format-headline-default-function org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-reveal-start-hook '(org-decrypt-entry) org-plantuml-jar-path "/home/immanuel/bin/plantuml.jar" org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes auto-fill-mode) org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-from-is-user-regexp "|\\" org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((emacs-lisp . t) (C . t) (python . t) (lilypond . t) (shell . t) (plantuml . t)) org-log-done 'time org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"] org-babel-python-command "ipython --simple-prompt -i --pylab" org-src-preserve-indentation t org-occur-hook '(org-first-headline-recenter) org-structure-template-alist '(("r" "#+BEGIN_SRC rust\n?\n#+END_SRC") ("p" "#+BEGIN_SRC plantuml\n?\n#+END_SRC") ("ha" "#+BEGIN_SRC haskell\n?\n#+END_SRC") ("ly" "#+LaTeX: \\linebreak\n#+ATTR_LaTeX: width=17cm\n#+BEGIN_SRC lilypond :file ?.png :noweb yes\n#+END_SRC") ("bnf" "#+BEGIN_SRC abnf\n?\n#+END_SRC") ("cpp" "#+NAME:\n#+HEADER: :tangle\n#+HEADER: :main no\n#+HEADER: :noeval\n#+HEADER: :noweb yes\n#+BEGIN_SRC cpp\n?\n#+END_SRC") ("yp" "#+END_SRC\n?\n#+BEGIN_SRC python :noweb yes") ("py" "#+BEGIN_SRC python :noweb yes\n?\n#+END_SRC") ("ab" "#+END_SRC\n#+BEGIN_SRC bash") ("ba" "#+BEGIN_SRC bash?\n#+END_SRC") ("le" "#+END_SRC\n#+BEGIN_SRC emacs-lisp?") ("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC") ("s" "#+BEGIN_SRC ?\n\n#+END_SRC") ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE")
[O] Bug: org-babel-tangle-comment-links does not honor org-babel-tangle-uncomment-comments in noweb comments [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/)]
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. Try the following code; #+NAME: start #+BEGIN_SRC emacs-lisp :tangle no (message "start") #+END_SRC #+NAME: end #+BEGIN_SRC emacs-lisp :tangle no (message "end") #+END_SRC #+BEGIN_SRC emacs-lisp :tangle output.el :comments noweb :noweb yes start <> end <> #+END_SRC #+BEGIN_SRC emacs-lisp :tangle no (let ((org-babel-tangle-comment-format-beg "start %start-line\n") (org-babel-tangle-comment-format-end "end %start-line\n") (org-babel-tangle-uncomment-comments t)) (org-babel-tangle-file (buffer-file-name)) (with-temp-buffer (insert-file-contents "output.el") (buffer-string))) #+END_SRC #+RESULTS: #+begin_example start 71 start ;; start 285 (message "start") ;; end 285 ;; start 1256 (message "start") ;; end 1256 end ;; start 360 (message "end") ;; end 360 ;; start 1331 (message "end") ;; end 1331 end 71 #+end_example You see the noweb comments are commented out. The reason is this cl-wrap definition in org-babel-expand-noweb-references. #+BEGIN_SRC emacs-lisp (let .. (c-wrap (lambda (text) (with-temp-buffer (funcall (intern (concat lang "-mode"))) (comment-region (point) (progn (insert text) (point))) (org-trim (buffer-string)) #+END_SRC Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-07-17 Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook '(org-clock-out-if-current) org-latex-listings t org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-odt-format-headline-function 'org-odt-format-headline-default-function org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-plantuml-jar-path "/home/immanuel/bin/plantuml.jar" org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes auto-fill-mode) org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-from-is-user-regexp "|\\" org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((emacs-lisp . t) (C . t) (python . t) (lilypond . t) (shell . t) (plantuml . t)) org-log-done 'time org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"] org-babel-python-command "ipython --simple-prompt -i --pylab" org-src-preserve-indentation t org-occur-hook '(org-first-headline-recenter) org-structure-template-alist '(("r" "#+BEGIN_SRC rust\n?\n#+END_SRC") ("p" "#+BEGIN_SRC plantuml\n?\n#+END_SRC") ("ha" "#+BEGIN_SRC haskell\n?\n#+END_SRC") ("ly" "#+LaTeX: \\linebreak\n#+ATTR_LaTeX: width=17cm\n#+BEGIN_SRC lilypond :file ?.png :noweb yes\n#+END_SRC") ("bnf" "#+BEGIN_SRC abnf\n?\n#+END_SRC") ("cpp" "#+NAME:\n#+HEADER: :tangle\n#+HEADER: :main no\n#+HEADER: :noeval\n#+HEADER: :noweb yes\n#+BEGIN_SRC cpp\n?\n#+END_SRC") ("yp" "#+END_SRC\n?\n#+BEGIN_SRC python :noweb yes") ("py" "#+BEGIN_SRC python :noweb yes\n?\n#+END_SRC") ("ab" "#+END_SRC\n#+BEGIN_SRC bash")
[O] Bug: org-babel-tangle-comment-links does not start-line but start-point. [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/)]
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. Try this in a buffer (results are also here for quick reference): #+NAME: start #+BEGIN_SRC emacs-lisp :tangle no (message "start") #+END_SRC #+NAME: end #+BEGIN_SRC emacs-lisp :tangle no (message "end") #+END_SRC #+BEGIN_SRC emacs-lisp :tangle output.el :comments noweb :noweb yes (progn <> <> ) #+END_SRC #+BEGIN_SRC emacs-lisp :tangle no (let ((org-babel-tangle-comment-format-beg "start %start-line") (org-babel-tangle-comment-format-end "end %start-line")) (org-babel-tangle-file (buffer-file-name)) (with-temp-buffer (insert-file-contents "output.el") (buffer-string))) #+END_SRC #+RESULTS: #+begin_example ;; start 12 (progn ;; start 15 (message "start") ;; end 15 ;; start 90 (message "end") ;; end 90 ) ;; end 12 #+end_example The reason is that the function org-babel-tangle-comment-links uses #+BEGIN_SRC emacs-lisp :tangle no ("start-line" . ,(number-to-string (org-babel-where-is-src-block-head) #+END_SRC Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-07-17 Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook '(org-clock-out-if-current) org-latex-listings t org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-odt-format-headline-function 'org-odt-format-headline-default-function org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-plantuml-jar-path "/home/immanuel/bin/plantuml.jar" org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes auto-fill-mode) org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-from-is-user-regexp "|\\" org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((emacs-lisp . t) (C . t) (python . t) (lilypond . t) (shell . t) (plantuml . t)) org-log-done 'time org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"] org-babel-python-command "ipython --simple-prompt -i --pylab" org-src-preserve-indentation t org-occur-hook '(org-first-headline-recenter) org-structure-template-alist '(("r" "#+BEGIN_SRC rust\n?\n#+END_SRC") ("p" "#+BEGIN_SRC plantuml\n?\n#+END_SRC") ("ha" "#+BEGIN_SRC haskell\n?\n#+END_SRC") ("ly" "#+LaTeX: \\linebreak\n#+ATTR_LaTeX: width=17cm\n#+BEGIN_SRC lilypond :file ?.png :noweb yes\n#+END_SRC") ("bnf" "#+BEGIN_SRC abnf\n?\n#+END_SRC") ("cpp" "#+NAME:\n#+HEADER: :tangle\n#+HEADER: :main no\n#+HEADER: :noeval\n#+HEADER: :noweb yes\n#+BEGIN_SRC cpp\n?\n#+END_SRC") ("yp" "#+END_SRC\n?\n#+BEGIN_SRC python :noweb yes") ("py" "#+BEGIN_SRC python :noweb yes\n?\n#+END_SRC") ("ab" "#+END_SRC\n#+BEGIN_SRC bash") ("ba" "#+BEGIN_SRC bash?\n#+END_SRC") ("le" "#+END_SRC\n#+BEGIN_SRC emacs-lisp?") ("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC") ("s" "#+BEGIN_SRC ?\n\n#+END_SRC")
[O] Editing elisp code block inserts spurious , before *
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. When editing this block with C- ' +BEGIN_SRC emacs-lisp :lexical t :tangle elisp.el (defvar *a-var* "blah") (defun v() (interactive) *a-var*) #+END_SRC On return it adds a , before the *a-var* #+BEGIN_SRC emacs-lisp :lexical t :tangle elisp.el (defvar *a-var* "blah") (defun v() (interactive) ,*a-var*) #+END_SRC This happens in a clean emacs started the -q flag, so it should not have anything to do with my configuration. Immanuel Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-07-17 Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook '(org-clock-out-if-current) org-latex-listings t org-pomodoro-long-break-length 30 org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-odt-format-headline-function 'org-odt-format-headline-default-function org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-plantuml-jar-path "/home/immanuel/bin/plantuml.jar" org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes auto-fill-mode) org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-from-is-user-regexp "|\\" org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((emacs-lisp . t) (C . t) (python . t) (lilypond . t) (shell . t) (plantuml . t)) org-log-done 'time org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"] org-babel-python-command "ipython --simple-prompt -i --pylab" org-src-preserve-indentation t org-occur-hook '(org-first-headline-recenter) org-pomodoro-ticking-sound "/home/immanuel/.emacs.d/straight/build/org-pomodoro/resources/tick.wav" org-structure-template-alist '(("r" "#+BEGIN_SRC rust\n?\n#+END_SRC") ("p" "#+BEGIN_SRC plantuml\n?\n#+END_SRC") ("ha" "#+BEGIN_SRC haskell\n?\n#+END_SRC") ("ly" "#+LaTeX: \\linebreak\n#+ATTR_LaTeX: width=17cm\n#+BEGIN_SRC lilypond :file ?.png :noweb yes\n#+END_SRC") ("bnf" "#+BEGIN_SRC abnf\n?\n#+END_SRC") ("cpp" "#+NAME:\n#+HEADER: :tangle\n#+HEADER: :main no\n#+HEADER: :noeval\n#+HEADER: :noweb yes\n#+BEGIN_SRC cpp\n?\n#+END_SRC") ("yp" "#+END_SRC\n?\n#+BEGIN_SRC python :noweb yes") ("py" "#+BEGIN_SRC python :noweb yes\n?\n#+END_SRC") ("ab" "#+END_SRC\n#+BEGIN_SRC bash") ("ba" "#+BEGIN_SRC bash?\n#+END_SRC") ("le" "#+END_SRC\n#+BEGIN_SRC emacs-lisp?") ("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC") ("s" "#+BEGIN_SRC ?\n\n#+END_SRC") ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE") ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE") ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE") ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM") ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER") ("C" "#+BEGIN_COMMENT\n?\n#+END_COMMENT") ("l" "#+BEGIN_EXPORT latex\n?\n#+END_EXPORT") ("L" "#+LaTeX: ") ("h" "#+BEGIN_EXPORT html\n?\n#+END_EXPORT") ("H" "#+HTML: ")
[O] Bug: :lexical header argument not handled when tangling [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/)]
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. #+BEGIN_SRC emacs-lisp :lexical t :tangle elisp.el (defun lex-p () "Return t if lexical binding is in effect." (interactive) (let (lex _lex-p) (let ((lex t)) (setq _lex-p (lambda () lex))) (if (funcall _lex-p) (message "lexical binding") (message "no lexical binding" (lex-p) #+END_SRC When evaluating this code block with C-c C-c I get lexical binding. When tangling it or with org-babel-load-file I get no lexical binding. Immanuel Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-07-17 Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook '(org-clock-out-if-current) org-latex-listings t org-pomodoro-long-break-length 30 org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-odt-format-headline-function 'org-odt-format-headline-default-function org-babel-tangle-body-hook '(il-org-babel-tangle-body-hook) org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-plantuml-jar-path "/home/immanuel/bin/plantuml.jar" org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes auto-fill-mode) org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-from-is-user-regexp "|\\" org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((emacs-lisp . t) (C . t) (python . t) (lilypond . t) (shell . t) (plantuml . t)) org-log-done 'time org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"] org-babel-python-command "ipython --simple-prompt -i --pylab" org-src-preserve-indentation t org-occur-hook '(org-first-headline-recenter) org-pomodoro-ticking-sound "/home/immanuel/.emacs.d/straight/build/org-pomodoro/resources/tick.wav" org-structure-template-alist '(("r" "#+BEGIN_SRC rust\n?\n#+END_SRC") ("p" "#+BEGIN_SRC plantuml\n?\n#+END_SRC") ("ha" "#+BEGIN_SRC haskell\n?\n#+END_SRC") ("ly" "#+LaTeX: \\linebreak\n#+ATTR_LaTeX: width=17cm\n#+BEGIN_SRC lilypond :file ?.png :noweb yes\n#+END_SRC") ("bnf" "#+BEGIN_SRC abnf\n?\n#+END_SRC") ("cpp" "#+header: :tangle\n#+header: :main no\n#+header: :noeval\n#+header: :noweb yes\n#+BEGIN_SRC cpp\n?\n#+END_SRC") ("yp" "#+END_SRC\n?\n#+BEGIN_SRC python :noweb yes") ("py" "#+BEGIN_SRC python :noweb yes\n?\n#+END_SRC") ("ab" "#+END_SRC\n#+BEGIN_SRC bash") ("ba" "#+BEGIN_SRC bash?\n#+END_SRC") ("le" "#+END_SRC\n#+BEGIN_SRC emacs-lisp?") ("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC") ("s" "#+BEGIN_SRC ?\n\n#+END_SRC") ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE") ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE") ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE") ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM") ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER") ("C" "#+BEGIN_COMMENT\n?\n#+END_COMMENT") ("l" "#+BEGIN_EXPORT latex\n?\n#+END_EXPORT") ("L&