From: Rainer M Krug <Rainer@krugs.de>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Bastien <bzg@gnu.org>,
"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>,
"Charles C. Berry" <ccberry@ucsd.edu>
Subject: Queestion concerning lists - was: [babel][PATCHES] ob-R patches for review
Date: Mon, 12 May 2014 16:01:11 +0200 [thread overview]
Message-ID: <m2egzzt7tk.fsf_-_@krugs.de> (raw)
In-Reply-To: <m2fvkfv1jn.fsf@krugs.de> (Rainer M. Krug's message of "Mon, 12 May 2014 10:33:48 +0200")
[-- Attachment #1: Type: text/plain, Size: 4672 bytes --]
Rainer M Krug <Rainer@krugs.de> writes:
> Eric Schulte <schulte.eric@gmail.com> writes:
>
>> Rainer M Krug <Rainer@krugs.de> writes:
>>
>>> Bastien <bzg@gnu.org> writes:
>>>
>>>> Hi Rainer,
>>>>
>>>> Rainer M Krug <r.m.krug@gmail.com> writes:
>>>>
>>>>> I'll look at it again tomorrow and let you know as I made some changes
>>>>> since then. Do you prefer one patch to several?
>>>>
>>>> Up to Eric's taste -- but in general I think a series of patches
>>>> is better, it allows you to isolate and fix conflicts more easily.
>>>
>>
>> I agree, multiple patches make future maintenance easier.
>>
>
> OK - I'll do so.
>
> A little bit off-topic, is there a "git way" of splitting one patch into
> several patches, if it was a single commit?
>
>>>> I missed some previous discussion in this thread. Are these patches
>>>> ready to be applied as is?
>>>>
>>>
>>>
>>> IMO, the patches hard coded behaviors that would better be customizable
>>> and optional.
>>>
>>> Rainer and I had some back and forth about this -- see the thread.
>>
>> With respect to these points, I'm inclined to agree with Charles in the
>> following.
>
> OK - see further comments below.
>
>>
>>> All you have to do is add this:
>>>
>>> (defvar org-babel-R-assign-elisp-function 'org-babel-R-assign-elisp
>>> "Name or definition of function to handle `:var name=value'
>>> header args."
>>> )
>>>
>>> and change one line in org-babel-variable-assignments:R from
>>>
>>> (org-babel-R-assign-elisp to
>>>
>>> (funcall org-babel-R-assign-elisp-function
>>>
>>> and the user can provide her own elisp assignment function.
>>>
>>> This gives users who want special behavior like creating something
>>> other than a data.frame the option of providing their own function.
>>
>> Would such a customization variable be difficult to add to your patches?
>
> I don't think so - I'll look into it.
>
>> If not would you mind submitting a version of the patches split into
>> multiple commits with as much of the hard-coded R code as feasible
>> placed into customizable variables along the lines of the
>> `org-babel-R-assign-elisp-function' variable suggested by Charles.
>
> I am thinking of actually not providing the R code in org-variables, but
> to put them into R files and to source them. By doing this, the
> customization could be done in R, which will be much easier for R users
> then to customize emacs variables.
>
> These would be sourced and stored into an environment "org:functions",
> using the same approach as ESS is using to store functions into an
> environment "ESSR". I would then put the variables transfered into
> "org:variables". These environments would only exist in the search path,
> and not overwrite any user set objects in R.
I am working on it, but I have a question concerning strings and lists
in elisp.
In the function org-babel-execute:R it says:
,----
| (inside
| (list (org-babel-expand-body:R body params graphics-file)))
`----
I now want to convert "inside" to a comma separated string. I am doing
now the following:
,----
| (replace-regexp-in-string "\n" ", " (format "%s" inside))
`----
but this does not look elegant to me, as I am converting inside to a
string and then do a replace. There is the function mapconcat, but I
don't get it to work:
,----
| (replace-regexp-in-string "\n" ", " (format "%s" inside))
| "( createOrgVariablesEnvironment(), plot(1))"
|
| (mapconcat 'identity inside ", ")
| " createOrgVariablesEnvironment()
| plot(1)"
`----
What am I missing?
Thanks,
Rainer
>
> As it needs to be sourced for each R process once, the right place would
> be in org-babel-R-initiate-session - correct?
>
> What would be the best place to put these R files?
>
>> One lesson I've certainly learned from the Org-mode mailing list is
>> that you can't anticipate all of the ways that your code will be used,
>> so up-front customizability generally pays off.
>
> OK - point taken - and I am definitely one of those users who thinks
> about unusual usages of certain features.
>
> Cheers,
>
> Rainer
>
>>
>> Thanks,
>> Eric
>>
>>>
>>> Thanks
>>>
>>> Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer@krugs.de
Skype: RMkrug
PGP: 0x0F52F982
[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]
next prev parent reply other threads:[~2014-05-12 14:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 12:43 [babel][PATCHES] ob-R patches for review Rainer M Krug
2014-04-29 18:15 ` Charles Berry
2014-04-30 12:28 ` Rainer M Krug
2014-04-30 22:49 ` Charles C. Berry
2014-05-01 9:10 ` Rainer M Krug
2014-05-07 10:27 ` Eric Schulte
2014-05-08 2:26 ` Charles Berry
2014-05-08 10:02 ` Rainer M Krug
2014-05-09 9:11 ` Rainer M Krug
2014-05-09 12:02 ` Rainer M Krug
2014-05-08 9:57 ` Rainer M Krug
2014-05-09 13:03 ` Bastien
2014-05-09 13:45 ` Rainer M Krug
2014-05-09 14:34 ` Eric Schulte
2014-05-12 8:33 ` Rainer M Krug
2014-05-12 12:23 ` Suvayu Ali
2014-05-12 12:41 ` Rainer M Krug
2014-05-12 14:01 ` Rainer M Krug [this message]
2014-05-12 15:23 ` Queestion concerning lists - was: " Eric Schulte
2014-05-12 15:21 ` Eric Schulte
2014-05-12 19:08 ` Rainer M Krug
2014-05-12 22:05 ` Charles C. Berry
[not found] ` <m2y4y2f499.fsf@krugs.de>
2014-05-16 18:22 ` Charles C. Berry
2014-06-06 16:11 ` Eric Schulte
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=m2egzzt7tk.fsf_-_@krugs.de \
--to=rainer@krugs.de \
--cc=bzg@gnu.org \
--cc=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@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).