I am not sure about doing it directly in the org
file.
What can be done is using C-c '
which is M-x org-edit-special
from the doc:
(org-edit-special &optional ARG)
Call a special editor for the element at point.
When at a table, call the formula editor with ‘org-table-edit-
formulas’.
When in a source code block, call ‘org-edit-src-code’.
When in a fixed-width region, call ‘org-edit-fixed-width-region’.
When in an export block, call ‘org-edit-export-block’.
When in a LaTeX environment, call ‘org-edit-latex-environment’.
When at an #+INCLUDE keyword, visit the included file.
When at a footnote reference, call ‘org-edit-footnote-reference’
On a link, call ‘ffap’ to visit the link at point.
Otherwise, return a user error.
in Clojure for example using cider
you can evaluate any line or part or region into a comment using 'eval-last-sexp-and-insert' as well as other functions.
In elisp
lisp-interaction-mode
you can evaluate-and-print
.
there's something similar in lpy
for Python
.
So it basically depends on the editing-mode which can also be configured in .emacs
, for example cider
for Clojure
will be:
(setq org-babel-clojure-backend 'cider)