From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: [BUG] Re: header argument :noweb-ref seems can't be resolved Date: Tue, 19 Dec 2017 15:31:45 +0800 Message-ID: <16cda4c5-1612-145d-9cd4-aa3facbf1363@gmail.com> References: <65580a97-24c4-a54c-655f-c37fcddd2cd1@gmail.com> <580C6094-17BE-44C7-8F4C-8BAF3113AA40@ucsd.edu> <8C1BE6FC-D004-49A9-82F5-03181061E848@ucsd.edu> <65375b87-03d9-45bb-6529-f5473c4d6af7@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRCNX-0003pt-UL for emacs-orgmode@gnu.org; Tue, 19 Dec 2017 02:31:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRCNS-0006Cg-Sm for emacs-orgmode@gnu.org; Tue, 19 Dec 2017 02:31:55 -0500 Received: from mail-io0-x22b.google.com ([2607:f8b0:4001:c06::22b]:34048) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRCNS-0006CC-M6 for emacs-orgmode@gnu.org; Tue, 19 Dec 2017 02:31:50 -0500 Received: by mail-io0-x22b.google.com with SMTP id f18so7507809ioh.1 for ; Mon, 18 Dec 2017 23:31:50 -0800 (PST) In-Reply-To: Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Berry, Charles" Cc: emacs-org-mode 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, numbchild@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. `<>'. > > > 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 > >