Hello everyone,
I encountered a change of behavior since org version 9.7 than removes
my source files instead of tangling them at the correct location, using
"org-babel-tangle-publish".
I have not found in the changelog any description of something that
could explain this change, so I report it here.
I'll try to show a minimal example of this issue.
* Description
I have the following file structure.
.
├── org
│ └── Code.org
├── publish.el
└── src
└── code.cpp
In the "org" directory, I have my org file that describes my code in
literate programming. It's content is:
#+begin_src c++ :tangle ../src/code.cpp
int a = 3;
#+end_src
The expected behavior is to generate the file "code.cpp" in the src
directory with the tangle mechanism. In this example code.cpp only
contains the line:
int a = 3;
To generate the sources from the org files, I use org-publish. The
code of publish.el is:
(require 'package)
(package-initialize)
(require 'org)
(require 'ox-publish)
(setq org-publish-project-alist
(list
(list "generate-source-code"
:base-directory "./org"
:base-extension "org"
:recursive t
:publishing-function '(org-babel-tangle-publish)
:publishing-directory "."
:auto-sitemap nil)))
(provide 'publish)
;;; publish.el ends here
To use the publish from a script I use the following command:
emacs --batch --load publish.el --eval '(org-publish "generate-source-code")'
* With org-mode 9.6
It works as expected, the code in "Code.cpp" is tangled into "src/code.cpp".
* With org-mode 9.7
I can see "code.cpp" is tangled at the root directory "./code.cpp",
but the file "src/code.cpp" that existed previously is deleted.
* Additional information
emacs version: "29.4"
org-version:
- Test with version 9.7.10 (commit 5ebd973e09d7a46d056f1cd9b5efc44e878cce9c)
- Test with version 9.6.30 (commit 071c6e986c424d2e496be7d0815d6e9cd83ae4e6)
If I use directly "org-babel-tangle-file" I don't have the problem,
the file in tangled to the right location:
emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "./org/Code.org")'
* Bonus question
As a guix user, I use contained environments as much as possible. In
the case described above, I generate an environment without git. I get
the following warning:
Error: (file-missing "Searching for program" "No such file or directory" "git")
It does not have any consequence on the tangling process, but I was
wondering if it was expected that my org-publish process depends on
git ? Would there be any benefit to add it to my environment ?
* Repository
I created a repository with some scripts to reproduce the error, using
guix to control the environment.
https://gitlab.inria.fr/gmarait/debug-org-9.7
Thank you and best regards,
Gilles Marait