emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [ANN] lisp/ob-tangle-sync.el


From: Mehmet Tekman
Subject: Re: [ANN] lisp/ob-tangle-sync.el
Date: Wed, 17 May 2023 15:45:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Hello again,

Ihor Radchenko <yantar92@posteo.net> writes:

>>> I recommend trying various edge cases with your patch.
>>> In particular:
>>>
>>> 1. Testing exclusive group inheritance when we inherit a header arg
>>>    value that matches :any:
>>>
>>>    #+PROPERTIES: header-args :tangle "foo.txt"
>>>    #+begin_src ... :tangle no
>>>
>>>    #+PROPERTIES: header-args :tangle no
>>>    #+begin_src ... :tangle "foo.txt"
>>>
>>>    #+PROPERTIES: header-args :tangle no
>>>    * Heading
>>>
>>>    :PROPERTIES:
>>>    :header-args: :tangle "foo.txt"
>>>    :END:
>>>    #+begin_src ... :tangle yes
>> ...
>>> I feel that the following code is not reliable when we inherit exact and
>>> :any exclusive group members in alternations.
>>
>> Ah, hmm - can you give me an example here? I thought the idea was that
>> an :any string would only be invokable once for a given header
>> parameter.
>
> See the above 3 examples: (1) "foo.txt" shadowed by "no"; (2) "no"
> shadowed by "foo.txt"; (3) "no" shadowed by "foo.txt" then shadowed by
> "yes".
>
> You can also consider "foo.txt" shadowed by "bar.txt" and other
> variations.

I've created a small patch that contains a single ert test function that
checks an example org file I made (based on the above as well as my own
toy file) to try to validate the `org-babel-merge-params' rewrite.

I've attached it below in case you want to test it...

...but there were a few cases where I wasn't entirely sure what the
result of the merge was supposed to be:

For example, a document with:

> #+TITLE: Header tests
> #+PROPERTY: header-args :tangle /tmp/default_tangle.txt
> 
> * Inherit tangle header from document
> 
> #+begin_src conf
>   (:tangle . /tmp/default_tangle.txt)
> #+end_src

I would expect the output of:

    (assoc :tangle (nth 2 (org-babel-get-src-block-info)))

within that block to evaluate to the contents written in that
block. Instead it evaluates to `(:tangle . no)' when run in a vanilla
Emacs. Is this expected?


Another example:

> * Header args overwritten by local header
> :PROPERTIES:
> :header-args: :tangle "foo.txt"
> :END:
> #+begin_src :tangle yes
>    (:tangle . foo.txt)
> #+end_src
>
> ** Inherited header
> 
> #+begin_src :tangle "file with spaces.txt"
>   (:tangle . "file with spaces.txt")
> #+end_src

The first block correctly gives "foo.txt" under vanilla Emacs, but the
second block also gives "foo.txt". Is this expected behaviour?


Best,
Mehmet

Attachment: 0004-testing-examples-header_test.org-New-example-test-fi.patch
Description: test org file and associated ert test function


reply via email to

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