emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] ob-tangle.el: Blocks overwrite each other when grouping b


From: Ihor Radchenko
Subject: Re: [PATCH v2] ob-tangle.el: Blocks overwrite each other when grouping before tangling
Date: Fri, 14 Jul 2023 08:45:12 +0000

Evgenii Klimov <eugene.dev@lipklim.org> writes:

> In this version I just updated the docstrings for the relevant
> functions, because prior to that it wasn't clear: does this "default
> export file for *all* source blocks" influence blocks with :tangle
> "yes"/FILENAME?

Thanks for the patch, but we need to be careful changing things in
ob-tangle. Not everything is well-documented there.

>  Optional argument TARGET-FILE can be used to specify a default
> -export file for all source blocks.
> +export file for all source blocks without :tangle header
> +argument.

This is confusing.
Is :tangle yes "without"?
What about inheritance?
What about default header args?
What if we have :tangle "/path/to/foo" and TARGET-FILE = "/path/to/foo"?
What if they are :tangle "./foo" and TARGET-FILE = "/full/path/to/foo"?
  
>  (defun org-babel-effective-tangled-filename (buffer-fn src-lang src-tfile)
> -  "Return effective tangled filename of a source-code block.
> +  "Return effective tangled absolute filename of a source-code block.

This will likely cause breakage.
There are two callers of `org-babel-effective-tangled-filename:
1. `org-babel-tangle-collect-blocks'
2. `org-babel-tangle-single-block'

`org-babel-tangle-single-block' passes (nth 1 result) as BUFFER-FN.
Its value is

(if org-babel-tangle-use-relative-file-links
                    (file-relative-name file)
                  file)

So,

> +  (let* ((fnd (file-name-directory (buffer-file-name
> +                                    (get-buffer buffer-fn))))

will fail when FILE contains file path.
And it does: (file (buffer-file-name (buffer-base-buffer)))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]