Hello again, I've attached two patches: 1. Tests for the existing merge parameters function, based on your last edits to my previous patch. 2. A rewrite of the entire merge parameters function, with the new tangle sync actions. It's a big patch mostly, because there were no intermediate commits in which the org framework wouldn't be broken. Hope that's okay! ** Brief Explanation of (2) This attempts to address the problem of having an :any keyword in a mutually exclusive group such as: #+begin_src elisp '((tangle yes no :any) (import export skip sync)) #+end_src Since every parameter (e.g. "export") is tested against both of these groups, and since a parameter that matches `:any' could be anything, then a parameter like "export" will match in both groups. To get around this, a merge strategy (see: `org-babel--merge-headers') builds an alist of exclusion groups that a parameter could belong to. e.g for a header with `:tangle myfile.txt skip' would give an alist of #+begin_src elisp (setq params-alist '(("skip" "tangle" "import") ("myfile.txt" "tangle"))) #+end_src Note that the exclusion groups are referenced by the first element in the group, acting as an alist key of sorts. This assumes that each exclusion group has a unique car. Parameters with two or more cdr elements are stripped of the exclusion group that have the `:any' parameter (i.e. "tangle"), resulting in: #+begin_src elisp (setq params-alist '(("skip" "import") ("myfile.txt" "tangle"))) #+end_src This alist is then inverted so that the group exclusion car becomes the key, and rearranged so that it follows the order of exclusion group definition (in this case, "tangle" group first then then "import" group). #+begin_src elisp (setq group-alist '(("tangle" "myfile.txt") ("import" "skip"))) #+end_src As the merge parameters function is called repeatedly for the same header, this builds to hold the whole related hierarchy of the org: #+begin_src org ,#+PROPERTIES: header-args :tangle topfile.txt import ,* One :PROPERTIES: :header-args: :tangle skip :END: ,#+begin_src bash :tangle myfile.txt ,#+end_src #+end_src which would yield: #+begin_src elisp (setq group-alist '(("tangle" "myfile.txt" "no" "topfile.txt") ("import" "skip" "import"))) #+end_src Assuming the hierarchy is given in the reverse order of this alist, the correct action is then taken as the car of these groups: `:tangle myfile.txt skip' ** Problems It seems to work well for most tests, except for the "file with spaces.txt" which I'm not sure how to proceed with. I feel like patching at the level `org-babel--merge-params' is the wrong way to go, and that I should patch it further upstream. That upstream leads to `org-babel-read' which currently chomps the quotes off anything it gets: #+begin_src elisp (org-babel-read " \"my file with quotes\" ") #+end_src I don't know if this is the expected behaviour for quoted strings with spaces, so before I proceed trying to patch this I thought I would check in with you and ask whether I should start patching here or not. Best, Mehmet