emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gilles Marait <gilles.marait@inria.fr>
To: emacs-orgmode@gnu.org
Cc: emmanuel agullo <emmanuel.agullo@inria.fr>
Subject: Change behavior of "org-babel-tangle-publish" from org 9.6 to 9.7 -- deleting source files and not tangling properly
Date: Mon, 2 Sep 2024 16:52:26 +0200 (CEST)	[thread overview]
Message-ID: <652111520.30366591.1725288746643.JavaMail.zimbra@inria.fr> (raw)

[-- 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 --]

             reply	other threads:[~2024-09-02 14:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02 14:52 Gilles Marait [this message]
2024-09-09 17:40 ` Change behavior of "org-babel-tangle-publish" from org 9.6 to 9.7 -- deleting source files and not tangling properly Ihor Radchenko
2024-09-10  8:49   ` Gilles Marait
2024-09-15 11:05     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=652111520.30366591.1725288746643.JavaMail.zimbra@inria.fr \
    --to=gilles.marait@inria.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=emmanuel.agullo@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).