emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] link abbreviation with multiple params, e. g. for geo locations


From: Eric Schulte
Subject: Re: [O] link abbreviation with multiple params, e. g. for geo locations
Date: Thu, 06 Jun 2013 11:01:38 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Michael Brand <address@hidden> writes:

> Hi all
>
> On Tue, May 7, 2013 at 12:29 AM, Christian Moe <address@hidden> wrote:
>> I'm afraid knowing that doesn't help much. The problem is, you don't know
>> what point the inline call is at, so you cannot point org-entry-get to
>> the right entry. If you try
>>
>> : (org-entry-get (point) "geo")
>>
>> it will look for a geo property in the outline entry the source block is
>> in, not in the entry the call comes from.
>>
>> I don't know any easy way to pass a parameter to a source block from an
>> outline entry property via an inline call in that entry. Others may know
>> better.
>
> After some trials it seemed to me that it is enough to just add a "loc
> (point-marker)" to a "let" of org-babel-ref-resolve. Now when the Lisp
> variable loc ("Location Of Call") is used as the first argument of
> org-entry-get it reads the property from that entry where the code
> block has been called. With this, Babel perfectly covers every
> requirement of my use case described earlier in this thread.
>
> Please review and comment my attached patch containing doc and ERT.
>

Please forgive my lateness to this thread.  Is the only requirement that
the point from which a code block was called be accessible to the
emacs-lisp code executed within that code block?

If so then there should be no need for additional development.  The
following already works thanks to some very recently applied changes.
See the attached example which demonstrates how to access the point of
the original call from a code block.

Cheers,

#+Options: ^:{}

* Org babel function for Google Maps browser

Here I simplify the previous Google maps function to simply
demonstrate the recovery of entry properties.

#+NAME: gmb
#+HEADER: :var geo_var=(or (org-entry-get org-babel-current-exec-src-block-head 
"geo") "4.56,7.89")
#+BEGIN_SRC emacs-lisp :results silent
  (format "geo_var is %s" geo_var)
#+END_SRC

* example of a geo location, realistic to try out
  :PROPERTIES:
  :geo:      4.56,7.89
  :END:

- call_gmb() =geo_var is 4.56,7.89=
  - interactively (type C-c on "call_gmb") visualize the current geo
    location on Google Maps with a marker and as "map" in the
    browser

* another geo location
  :PROPERTIES:
  :geo:      4.44,5.55
  :END:

- call_gmb() =geo_var is 4.44,5.55=
  - visualize another geo location as "terrain"
-- 
Eric Schulte
http://cs.unm.edu/~eschulte

reply via email to

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