emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Accessing properties in code blocks
@ 2020-01-09 20:23 sergio ruiz
  2020-01-09 20:40 ` Mike Gauland
  0 siblings, 1 reply; 5+ messages in thread
From: sergio ruiz @ 2020-01-09 20:23 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 959 bytes --]

I realized this is related to my previous post, but if i could do this, it would save alot of work.

I would like to access the values of the properties inside the (shell) code block.

Thanks!



* Report section
:PROPERTIES:
:url:      http://www.googole.com
:END:

I'd like to have several sections like this. Each section woudl have different values for the same property. They would make different calls to respective url. something like

#+BEGIN_SRC shell
curl <url_property_here>
#+END_SRC

where the result of that call woudl be whatever i get from that running curl on that url.



----
peace,
sergio
photographer, journalist, visionary

Public Key: https://pgp.key-server.io/pks/lookup?op=get&search=0x69B08F58923AB3A2
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


[-- Attachment #1.2: Type: text/html, Size: 3995 bytes --]

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Accessing properties in code blocks
  2020-01-09 20:23 Accessing properties in code blocks sergio ruiz
@ 2020-01-09 20:40 ` Mike Gauland
  2020-01-09 21:32   ` sergio ruiz
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Gauland @ 2020-01-09 20:40 UTC (permalink / raw)
  To: emacs-orgmode

On 10/01/2020 9:23 am, sergio ruiz wrote:
> * Report section
> :PROPERTIES:
> :url: http://www.googole.com
> :END:
>
> I'd like to have several sections like this. Each section woudl have 
> different values for the same property. They would make different 
> calls to respective url. something like
>
> #+BEGIN_SRC shell
> curl <url_property_here>
> #+END_SRC
>
You can use elisp code to look up the property you want to pass as a 
variable:

#+BEGIN_SRC shell :var url=(org-macro--get-property "url" "")
curl $url
#+END_SRC

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Accessing properties in code blocks
  2020-01-09 20:40 ` Mike Gauland
@ 2020-01-09 21:32   ` sergio ruiz
  2020-01-09 23:26     ` Mike Gauland
  0 siblings, 1 reply; 5+ messages in thread
From: sergio ruiz @ 2020-01-09 21:32 UTC (permalink / raw)
  To: Mike Gauland; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 800 bytes --]

I am getting:

eval: Symbol’s function definition is void: org-macro--get-property

I am using:

Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)
Mark set

Is this a newer function?

Thanks!



> You can use elisp code to look up the property you want to pass as a variable:
> 
> #+BEGIN_SRC shell :var url=(org-macro--get-property "url" "")
> curl $url
> #+END_SRC
> 
> 

----
peace,
sergio
photographer, journalist, visionary

Public Key: https://pgp.key-server.io/pks/lookup?op=get&search=0x69B08F58923AB3A2
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


[-- Attachment #1.2: Type: text/html, Size: 3662 bytes --]

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Accessing properties in code blocks
  2020-01-09 21:32   ` sergio ruiz
@ 2020-01-09 23:26     ` Mike Gauland
  2020-01-10 13:16       ` sergio ruiz
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Gauland @ 2020-01-09 23:26 UTC (permalink / raw)
  To: sergio ruiz; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 959 bytes --]

Looking at git, it seems that was introduced in 9.2.

On 10/01/2020 10:32 am, sergio ruiz wrote:
> I am getting:
>
> eval: Symbol’s function definition is void: org-macro--get-property
>
> I am using:
>
> Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
> /Applications/Emacs.app/Contents/Resources/lisp/org/)
> Mark set
>
> Is this a newer function?
>
> Thanks!
>
>
>
>> You can use elisp code to look up the property you want to pass as a 
>> variable:
>>
>> #+BEGIN_SRC shell :var url=(org-macro--get-property "url" "")
>> curl $url
>> #+END_SRC
>>
>>
>
> ----
> peace,
> sergio
> photographer, journalist, visionary
>
> Public Key: 
> https://pgp.key-server.io/pks/lookup?op=get&search=0x69B08F58923AB3A2
> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
> @sergio_101@mastodon.social <mailto:sergio_101@mastodon.social>
> https://sergio101.com
> http://www.codeandmusic.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101
>

[-- Attachment #2: Type: text/html, Size: 5967 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Accessing properties in code blocks
  2020-01-09 23:26     ` Mike Gauland
@ 2020-01-10 13:16       ` sergio ruiz
  0 siblings, 0 replies; 5+ messages in thread
From: sergio ruiz @ 2020-01-10 13:16 UTC (permalink / raw)
  To: Mike Gauland; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 668 bytes --]

Ah. I am running the org-mode that came with my emacs. I tried updating it, but ran into version problems. I will see if there is another emacs-lisp way to get that info.

Thanks!


> On Jan 9, 2020, at 6:26 PM, Mike Gauland <mikelygee@gmail.com> wrote:
> 
> Looking at git, it seems that was introduced in 9.2.

----
peace,
sergio
photographer, journalist, visionary

Public Key: https://pgp.key-server.io/pks/lookup?op=get&search=0x69B08F58923AB3A2
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


[-- Attachment #1.2: Type: text/html, Size: 3740 bytes --]

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-10 13:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09 20:23 Accessing properties in code blocks sergio ruiz
2020-01-09 20:40 ` Mike Gauland
2020-01-09 21:32   ` sergio ruiz
2020-01-09 23:26     ` Mike Gauland
2020-01-10 13:16       ` sergio ruiz

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).