* return link to :file when using #+call @ 2010-12-31 0:05 Myles English 2011-01-01 22:57 ` Myles English 0 siblings, 1 reply; 5+ messages in thread From: Myles English @ 2010-12-31 0:05 UTC (permalink / raw) To: emacs-orgmode Hello all, Please could someone show me how to get an org link to the file in the results when using #+call with an R source block? This is the test I am using: #+source: foo() #+begin_src R :file bar.png plot(1,1) #+end_src #+results: foo() [[file:bar.png]] ( so that works fine ) #+call: foo[:file baz.png]() #+results: foo[:file baz.png]() : baz.png ( but I wanted [[file:baz.png]] there ) I'm using the commit 1495bc6 of 12th December. Thank you, Myles ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: return link to :file when using #+call 2010-12-31 0:05 return link to :file when using #+call Myles English @ 2011-01-01 22:57 ` Myles English 2011-01-06 6:28 ` Eric Schulte 0 siblings, 1 reply; 5+ messages in thread From: Myles English @ 2011-01-01 22:57 UTC (permalink / raw) To: emacs-orgmode Myles English <mylesenglish <at> gmail.com> writes: > #+source: foo() > #+begin_src R :file bar.png > plot(1,1) > #+end_src This works but I have to repeat the filename: #+call: foo[:file baz.png]() :file baz.png #+results: foo[:file baz.png]() [[file:baz.png]] Myles ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: return link to :file when using #+call 2011-01-01 22:57 ` Myles English @ 2011-01-06 6:28 ` Eric Schulte 2011-01-23 1:13 ` Myles English 0 siblings, 1 reply; 5+ messages in thread From: Eric Schulte @ 2011-01-06 6:28 UTC (permalink / raw) To: Myles English; +Cc: emacs-orgmode Hi Myles, Currently I believe the best option is the solution you posted below, the file name is repeated because both the code block and the call line need to know the file name to create the file and the link respectively. Cheers -- Eric Myles English <mylesenglish@gmail.com> writes: > Myles English <mylesenglish <at> gmail.com> writes: > >> #+source: foo() >> #+begin_src R :file bar.png >> plot(1,1) >> #+end_src > > This works but I have to repeat the filename: > > #+call: foo[:file baz.png]() :file baz.png > > #+results: foo[:file baz.png]() > [[file:baz.png]] > > Myles > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: return link to :file when using #+call 2011-01-06 6:28 ` Eric Schulte @ 2011-01-23 1:13 ` Myles English 2011-01-23 9:14 ` Dan Davison 0 siblings, 1 reply; 5+ messages in thread From: Myles English @ 2011-01-23 1:13 UTC (permalink / raw) To: Eric Schulte; +Cc: emacs-orgmode Thanks for your answer Eric. Recent changes as per http://thread.gmane.org/gmane.emacs.orgmode/35396 means that this no longer works. To recap: what I would like to do is to #+call an R source block, passing a filename, and have it write a plot to that file and also insert a link to that file in the org file. Any ideas? Here is what I have tried: #+source: foo() #+begin_src R :file bar.png :results graphics plot(1,1) #+end_src #+call: foo[:file baz.png]() #+results: foo[:file baz.png]() : baz.png baz.png contains a plot, but no file link is inserted. #+call: foo() #+results: foo() : bar.png bar.png contains a plot, but no file link is inserted. #+call: foo[:file biff.png]() :file biff.png #+results: foo[:file biff.png]() [[file:biff.png]] a file link is inserted but file biff.png contains 'biff.png' #+call: foo[:file pow.png]() :file pow.png :results graphics #+results: foo[:file pow.png]() [[file:pow.png]] a file link is inserted but file pow.png contains 'pow.png' Thanks, Myles On Wed, 05 Jan 2011 23:28:00 -0700 "Eric Schulte" <schulte.eric@gmail.com> wrote: > Hi Myles, > > Currently I believe the best option is the solution you posted below, > the file name is repeated because both the code block and the call > line need to know the file name to create the file and the link > respectively. > > Cheers -- Eric > > Myles English <mylesenglish@gmail.com> writes: > > > Myles English <mylesenglish <at> gmail.com> writes: > > > >> #+source: foo() > >> #+begin_src R :file bar.png > >> plot(1,1) > >> #+end_src > > > > This works but I have to repeat the filename: > > > > #+call: foo[:file baz.png]() :file baz.png > > > > #+results: foo[:file baz.png]() > > [[file:baz.png]] > > > > Myles > > > > > > _______________________________________________ > > Emacs-orgmode mailing list > > Please use `Reply All' to send replies to the list. > > Emacs-orgmode@gnu.org > > http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: return link to :file when using #+call 2011-01-23 1:13 ` Myles English @ 2011-01-23 9:14 ` Dan Davison 0 siblings, 0 replies; 5+ messages in thread From: Dan Davison @ 2011-01-23 9:14 UTC (permalink / raw) To: emacs-orgmode Myles English <mylesenglish@gmail.com> writes: > Thanks for your answer Eric. Recent changes as per > http://thread.gmane.org/gmane.emacs.orgmode/35396 > means that this no longer works. Thanks for bringing this up Myles. > To recap: what I would like to do is to #+call an R source > block, passing a filename, and have it write a plot to that file and > also insert a link to that file in the org file. Any ideas? > > Here is what I have tried: > > #+source: foo() > #+begin_src R :file bar.png :results graphics > plot(1,1) > #+end_src > > > #+call: foo[:file baz.png]() > > #+results: foo[:file baz.png]() > : baz.png > > baz.png contains a plot, but no file link is inserted. Yes you need :results file, so the line should be #+call: foo[:file baz.png]() :results file Explanation: In simple single-block usage, :file automatically sets :results file. But here :file in square brackets is passed to block foo, so the #+call line needs its own :results file. (And in fact :file would be wrong; see below). > > #+call: foo() > > #+results: foo() > : bar.png > > bar.png contains a plot, but no file link is inserted. Yep. Same as above, except here you haven't overridden the file name. > #+call: foo[:file biff.png]() :file biff.png > > #+results: foo[:file biff.png]() > [[file:biff.png]] > > a file link is inserted but file biff.png contains 'biff.png' Right, this one's kind of instructive for understanding this stuff. Here, foo returns its file name as a string, so "biff.png". The #+call line has been told to send its results to file with the :file argument, and it takes that literally, writing the string "biff.png" to its output file. So if what we want is a file containing graphics, we are not going to want :file on the #+call line. What we want is to interpret the string as a file name, and that's what :results file does. > > #+call: foo[:file pow.png]() :file pow.png :results graphics > > #+results: foo[:file pow.png]() > [[file:pow.png]] > > a file link is inserted but file pow.png contains 'pow.png' Same as above. #+call receives a string from foo; it can't turn that string into the desired graphics. In fact, :results graphics currently only has any effect on an R block (i.e. at an R block, or passed to an R block inside [ ... ]). Dan > > Thanks, > > Myles > > > On Wed, 05 Jan 2011 23:28:00 -0700 > "Eric Schulte" <schulte.eric@gmail.com> wrote: > >> Hi Myles, >> >> Currently I believe the best option is the solution you posted below, >> the file name is repeated because both the code block and the call >> line need to know the file name to create the file and the link >> respectively. >> >> Cheers -- Eric >> >> Myles English <mylesenglish@gmail.com> writes: >> >> > Myles English <mylesenglish <at> gmail.com> writes: >> > >> >> #+source: foo() >> >> #+begin_src R :file bar.png >> >> plot(1,1) >> >> #+end_src >> > >> > This works but I have to repeat the filename: >> > >> > #+call: foo[:file baz.png]() :file baz.png >> > >> > #+results: foo[:file baz.png]() >> > [[file:baz.png]] >> > >> > Myles >> > >> > >> > _______________________________________________ >> > Emacs-orgmode mailing list >> > Please use `Reply All' to send replies to the list. >> > Emacs-orgmode@gnu.org >> > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-23 9:15 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-12-31 0:05 return link to :file when using #+call Myles English 2011-01-01 22:57 ` Myles English 2011-01-06 6:28 ` Eric Schulte 2011-01-23 1:13 ` Myles English 2011-01-23 9:14 ` Dan Davison
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).