> What the subject says. Commented subtrees are never exported or tangled, > but they are evaluated when you do `org-babel-execute-subtree` on a > parent tree. The documentation > (https://orgmode.org/manual/Comment-Lines.html) kind of implies that it > doesn't happen, but it's true that it is said in a subsection of the > "Exporting" section, so maybe the context is slightly different. But in > that case, even if the behavior would not contradict the documentation, > it would still be inconsistent with the tangling behavior. > > Should it be considered a bug and be fixed? Or should just the > documentation be updated to clarify it? Let me know what you think and > I'll submit a patch either way. > > The issue is trivial to reproduce, but I provide a basic example here: > * Parent > ** COMMENT Commented subtree > #+begin_src emacs-lisp > (message "This should not be executed") > #+end_src >
Sorry for the late reply, I got sick basically right after I claimed this. I don't see the issue here. The https://orgmode.org/manual/Comment-Lines.html documentation is a subchapter of the export documenation. So the content of that section only applies to the export process. Specifically, we see the following: "Finally, a ‘COMMENT’ keyword at the beginning of an entry, but after any other keyword or priority cookie, comments out the entire subtree. In this case, the subtree is not exported and no code block within it is executed or tangled(2)". If you check the code, you will see that ox.el uses `org-babel-exp-process-buffer' when it exports a src-block. That function confirms a src-block is not in a commented subtree before executing it. Additionally, `org-babel-tangle-collect-blocks' in ob-tangle.el checks if a src-block is in a commented subtree before collecting. So, the behavior of those functions is consistent with the documentation. `org-babel-execute-subtree' does not confirm a subtree is not commented before it is executed. If you check "16.5 Evaluating Code Blocks" in the docs, you will see that there are two ways to block `org-babel-execute-subtree' from executing a src-block: the `eval' header or changing the value of `org-confirm-babel-evaluate'. So, I understand the confusion but I don't think this is a bug. However, I think it could be interesting to have `org-babel-execute-subtree' also check to see if a header is commented. But that would be a separate issue and I think you should probably gather some feedback from others before you work on that. Le jeu. 11 juin 2026 à 05:08, Earl Chase <[email protected]> a écrit : > > Owned. I will take a look at this. > > Le jeu. 11 juin 2026 à 03:42, Ignacio Casso <[email protected]> a > écrit : >> >> >> What the subject says. Commented subtrees are never exported or tangled, >> but they are evaluated when you do `org-babel-execute-subtree` on a >> parent tree. The documentation >> (https://orgmode.org/manual/Comment-Lines.html) kind of implies that it >> doesn't happen, but it's true that it is said in a subsection of the >> "Exporting" section, so maybe the context is slightly different. But in >> that case, even if the behavior would not contradict the documentation, >> it would still be inconsistent with the tangling behavior. >> >> Should it be considered a bug and be fixed? Or should just the >> documentation be updated to clarify it? Let me know what you think and >> I'll submit a patch either way. >> >> The issue is trivial to reproduce, but I provide a basic example here: >> * Parent >> ** COMMENT Commented subtree >> #+begin_src emacs-lisp >> (message "This should not be executed") >> #+end_src >> >> >> ------------------------------------------------------------------------ >> >> Emacs : GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, >> cairo version 1.18.0) >> of 2025-12-31 >> Package: Org mode version 9.8 (release_9.8 @ >> /home/ignacio/repos/built-from-source/org-mode/lisp/) >>
