emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [BUG] Re: header argument :noweb-ref seems can't be resolved


From: stardiviner
Subject: [O] [BUG] Re: header argument :noweb-ref seems can't be resolved
Date: Tue, 19 Dec 2017 15:31:45 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

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, address@hidden 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

[Prev in Thread] Current Thread [Next in Thread]