emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Berry, Charles" <ccberry@ucsd.edu>
To: "numbchild@gmail.com" <numbchild@gmail.com>
Cc: emacs-org-mode <emacs-orgmode@gnu.org>
Subject: Re: header argument :noweb-ref seems can't be resolved
Date: Tue, 19 Dec 2017 04:59:49 +0000	[thread overview]
Message-ID: <C639A75C-CA4B-464B-A384-E16F55623665@ucsd.edu> (raw)
In-Reply-To: <CAL1eYuJ8iehpS+T5zD=Fis7kuJEhvs08mZtsH3T+Gb+8B4OgzQ@mail.gmail.com>



> 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. `<<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	other threads:[~2017-12-19  5:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-17 14:58 header argument :noweb-ref seems can't be resolved stardiviner
2017-12-17 17:40 ` Berry, Charles
2017-12-18  2:08   ` stardiviner
2017-12-18  4:12     ` Berry, Charles
2017-12-18  4:28       ` stardiviner
2017-12-18 16:46         ` Berry, Charles
2017-12-18 17:28           ` numbchild
2017-12-19  4:59             ` Berry, Charles [this message]
2017-12-19  7:31               ` [BUG] " stardiviner
2017-12-19 17:49                 ` Berry, Charles
2017-12-19 19:00                   ` Nicolas Goaziou
2017-12-20  5:32                     ` Berry, Charles
2017-12-20 12:23                       ` Nicolas Goaziou
2017-12-20 15:41                         ` numbchild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C639A75C-CA4B-464B-A384-E16F55623665@ucsd.edu \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=numbchild@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).