On 2021-02-11 18:44, Diego Zamboni wrote: > #2 is known (maybe documented? Not sure) behavior: using :noweb-ref > accumulates multiple blocks with the same name, whereas #+NAME uses only > the first one.
Deep in org-babel-tangle, (org-babel-map-src-blocks nil (let ((i (let ((org-babel-current-src-block-location (point))) (org-babel-get-src-block-info 'light)))) (when (equal (or (cdr (assq :noweb-ref (nth 2 i))) (nth 4 i)) source-name) ...))) So, while :noweb-ref gets priority over #+NAME, we can still accumulate blocks having the same #+NAME (provided there's no overriding :noweb-ref). > I think #+NAME's are supposed to be unique within a document. Even though I'm a huge fan of this behavior, which lines up well with the traditional WEB and Noweb behavior, the Org manual's discussion of code blocks does say, "For duplicate names, Org mode's behavior is undefined." [Section 14.1] So, Dear Org Maintainers, Please do not change org-babel-tangle's accumulation behavior for duplicate #+NAME's. It's handy, and users of other literate programming tools will find it familiar. Also, #+NAME is a nicer per-block syntax than :noweb-ref. Sincerely, Kevin M. Stout