emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Change behavior of "org-babel-tangle-publish" from org 9.6 to 9.7 -- deleting source files and not tangling properly
@ 2024-09-02 14:52 Gilles Marait
  2024-09-09 17:40 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Gilles Marait @ 2024-09-02 14:52 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: emmanuel agullo

[-- Attachment #1: Type: text/plain, Size: 2942 bytes --]

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 

[-- Attachment #2: Type: text/html, Size: 3104 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-15 13:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 14:52 Change behavior of "org-babel-tangle-publish" from org 9.6 to 9.7 -- deleting source files and not tangling properly Gilles Marait
2024-09-09 17:40 ` Ihor Radchenko
2024-09-10  8:49   ` Gilles Marait
2024-09-15 11:05     ` Ihor Radchenko
2024-12-15 13:55       ` Ihor Radchenko

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).