Confirmed. I don't know how to fix this problem, so maybe report to Org-mode ML is the better way. (I changed the message title by prepend [BUG])

On 12/19/2017 12:59 PM, Berry, Charles wrote:

On Dec 18, 2017, at 9:28 AM, numbch...@gmail.com wrote:

Hope someone can help here.

OK. I think I have it. `org-babel-params-from-properties' uses 
`org-babel-current-src-block' to figure out where to look for properties. And o-b-c-s-b-l 
is let bound in `org-babel-noweb-expand-references' to the src block location with the 
noweb reference, e.g. `<<whatnot>>'.


The problem can be illustrated like so. Put this in a buffer:

#+begin_src org

   ,* abc
     :PROPERTIES:
     :header-args: :noweb-ref abcblocks
     :END:

   ,#+name: got-abc
   ,#+begin_src R
   1+2
   ,#+end_src


   ,* def

#+end_src

execute this:

#+begin_src emacs-lisp
   (defun show-prob (obcsbl)
     (let
        ((org-babel-current-src-block-location obcsbl))
      (assq :noweb-ref (nth 2 (org-babel-get-src-block-info)))))
#+end_src

Then put point in the got-abc src block and type

     M-: (show-prob (point)) RET

and you will see `(:noweb-ref . "abcblocks")' in the minibuffer.

Now try

    M-:  (show-prob 1000) RET

and the result is `nil'.

The problem can be fixed by let-binding `org-babel-current-src-block-location' 
to `beg-body' in `org-babel-noweb-expand-references' like this

                  (org-babel-map-src-blocks nil
                            (let*
                                ((org-babel-current-src-block-location beg-body)
                                 (i (org-babel-get-src-block-info 'light)))
        
but maybe it is better to change  `org-babel-params-from-properties'.

WDYT?

Chuck




Reply via email to