emacs-orgmode
[Top][All Lists]
Advanced

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

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


From: Berry, Charles
Subject: Re: [O] header argument :noweb-ref seems can't be resolved
Date: Tue, 19 Dec 2017 04:59:49 +0000


> 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]