org-auto-tangle
org-auto-tangle copied to clipboard
Tangling of file get indefinitely stopped by source block evaluation waiting for result
Sorry, I'm quite a beginner with emacs lisp, so it is hard for me to debug it. I am quite interested in the package since there are many files I would want auto tangle for, but also others I don't want to, so it is annoying to use a hook with after-save or manually tangling everytime.
I am using doom emacs with emacs 27.2.
My config is :
(package! org-auto-tangle)
in my package.el and
(use-package! org-auto-tangle
:defer t
:hook (org-mode . org-auto-tangle-mode))
in my config.el
Steps to reproduce:
- Install the package
- Add
#+auto_tangle: t
under file title - Changing and saving file
I do have a message writing "Tangling -name of my file- ..." so the package seems to work, but then nothing. I tried adding the source code directly to my config files. I tried removing the async part to see if it was the cause, but that didn't change anything. The args in org-auto-tangle-async seem to be correctly initialized, but the code seems to never enter lambda functions.
Let me know if I can provide anything more than could be helpful.
I've never really tried with doom emacs. I'll do so and check back with you.
Thank you. Meanwhile I figured at least one thing that caused the issue. I have source blocks like that (to tangle snippets - cause I use multiple devices) :
#+name: numbersign
#+begin_src emacs-lisp :exports results :noweb yes :tangle no
(prin1-to-string "#" t)
#+end_src
#+begin_src elisp :tangle ~/.doom.d/snippets/org-mode/elisp :mkdirp yes :noweb yes
# -*- mode: snippet -*-
# name: elisp
# key: elisp
# uuid: elisp
# --
#+begin_src emacs-lisp
`%`$0
<<numbersign()>>+end_src
#+end_src
The problem is the async process waits for permission to evaluate the first block, but there is no way for me to accept, and I haven't found a solution yet to make it automatically evaluate the source block.
I found a solution to change how I write my snippets and now it works. But still, if I have, for any reason a source block that needs evaluation, I believe it will hang and never end. I changed the issue title to be more representative of the problem.
I'm encountering a similar issue where auto (async) tangling will not complete, but instead opens an *emacs*
buffer with
Lisp expression: No comment syntax is defined. Use:
I don't have any elisp
blocks in the current org file, or even noweb
.
I have #+property: header-args :tangle Dockerfile :mkdirp yes :comments both
, and then some source blocks specify a different tangle destination and/or a :shebang
.
@yilkalargaw:
On further debugging, this appears to happen with a combination of :comments both
and the language set to dockerfile
. Here's a repro:
:PROPERTIES:
#+property: header-args :tangle test_tangled :comments both
:END:
#+begin_src dockerfile
# test2
#+end_src
Opening such blocks works as normal (they open in dockerfile-mode
), and I'm also able to org-babel-tangle
this file without any prompts about comment syntax.
Any suggestions?
Sorry @indigoviolet for the delay on response. I'll be looking into this issue today and I'll let you know.
Thanks I appreciate it.
Just ran into this issue again, with just-mode
this time. Any ideas?
Just want to chip in my thoughts after running into these issues.
I think the problem mainly lies on the fact that org-auto-tangle
uses emacs-async to execute the tangling process on the background. emacs-async
spawn new emacs
instance using the -Q
flag by default, thus not loading any user configuration. I think this is mainly for speed (because loading all emacs configuration takes at least few seconds).
On the other hand, bare emacs doesn't have some major mode pre installed (the major-mode that causes issues). When we tangle using bare emacs on the user downloaded major-mode, bare emacs doesn't know the comment string defined my that mode, thus org-mode needs to ask for the comment-syntax so that it can place the comment string correctly.
I think possible improvements would be giving user the option to toggle asynchronous tangling, so that we can choose either blocking+comment or async+no_comments.
The safest thing we can do right now is to use :comments no
on those major-modes so that org never have the needs to insert comment string, and thus do not need to know what comment syntax need to be used.
It would be easy to add noasync
variable but wouldn't that just be switching save for tangle in org mode (i.e. because tangling automatically saves). The reason for this package is that it is asynchronous I'm wondering what value it would provide if you don't want it to be asynchronous. Couldn't that just be done using a hook instead of this package. I would like to know before implementing it.
I think the main benefit is to have those two mode available on a switch. Let's say that I have 5 org files, but 1 of them is written for new language. 4 other org files can stay on asnyc tangling, and with the other file, it will be as easy as #+auto_tangle: noasync
instead of implementing other hook.
TBH I'm using this package mainly because I'm new to emacs, and doesn't think of the possibility of doing what this package have done using plain hook :joy: