It seems like this is nearly all possible already (see below). It is a little wonky that you have to put text in a src txt block to achieve it, but otherwise what is missing? * Main document See [[id:BAD97113-3561-4A4A-BA07-0CD5BF6BA35F][There is a reason we only support two args]] (text to text) for notes about this function. The addition is done in line [[(add)]] (text to code). #+NAME: DOC-OF-ADD #+BEGIN_SRC txt "We use the function add to calculate the sum of two numbers." #+END_SRC #+NAME: ADD #+BEGIN_SRC emacs-lisp -n -r :noweb yes :tangle test.el (defun add (x y) <> ;; code to code ;; [[id:BAD97113-3561-4A4A-BA07-0CD5BF6BA35F][There is a reason we only support two args]] code to text (+ x y) (ref:add) ) #+END_SRC #+RESULTS: ADD : add ** Notes *** There is a reason we only support two args :PROPERTIES: :ID: BAD97113-3561-4A4A-BA07-0CD5BF6BA35F :END: John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Sun, May 13, 2018 at 10:48 PM, Eric S Fraga wrote: > On Saturday, 12 May 2018 at 13:29, ZHUO QL (KDr2) wrote: > > Hi all, I just post a proposal for orgmode on my website(generated by > orgmode): > > http://kdr2.com/tech/emacs/1805-proposal-org-ref-code-to-text.html . > > Here is the source of the proposal: > > # -*- mode: org; mode: auto-fill; -*- > > > > #+TITLE: Proposal for Orgmode: references from code to text. > > #+AUTHOR: KDr2 > > [...] > > > - Beside the ~NAME~, we could also support reference via the > > ~CUSTOM_ID~ property or anything else that can locate a text chunk. > > - In the tangling process, we should do some kind of transformation of > > the target text, for example, escape the quote mark. A hook may be > > needed to let the user customize the transformation too. > > > > What do you think? > > I like the symmetry of having src reference text. I guess, in what you > propose above, that the text that would be incorporated would be a > single element (in org parsing parlance) or else we would have to > specify an extent in the link information. > > Are you able to implement something? I would definitely help test it. > > -- > Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-591-gee336b >