Mehmet Tekman <mtekma...@gmail.com> writes: >> 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...
Is the patch testing your code? (Note on the ert tests: we generally prefer `org-test-with-temp-text' - the old approach with test IDs is not very readable because one needs to search those IDs manually when debugging test failures.) > ...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? You forgot C-c C-c on the PROPERTY line, or re-opening the file. #+PROPERTY lines are not automatically parsed when you add them. They are only parsed upon explicit request (C-c C-c) or when opening the file. > 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? You forgot to specify the source block languages. Org sees your example as two src blocks of language ":tangle" with no proper header arguments. (See M-x org-lint) If you add a language, like #+begin_src conf :tangle yes (:tangle . foo.txt) #+end_src The expected result is (:tangle . "yes") for the first block and (:tangle . "file with spaces.txt") for the second block. -- 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>