Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] R plugin on Mac OS X

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] R plugin on Mac OS X


Chronological Thread 
  • From: Michael Lachmann <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] R plugin on Mac OS X
  • Date: Fri, 13 Jul 2012 02:15:54 +0800

On 12 July 2012 18:38, Joris van der Hoeven <address@hidden> wrote:
> Hi Michael,
>
> On Thu, Jul 12, 2012 at 04:50:21PM +0800, Michael Lachmann wrote:
>> 1. The function v() in R will insert the current plot into the buffer.
>> It is supposed to support inserting the image using "ps:", and also
>> using
>> "scheme:(image (tuple (raw-data..."
>> and
>> "scheme:(image (tuple (# ..."
>>
>> I think this used to work at some point. Now, when I send hex data, I
>> get the error:
>> <error|bad image|<tuple<error|compound
>> #XXXX... >|
>> png>>
>>
>> When I save the file, and reload it, I get a correct figure, though.
>>
>> The commands that generate the image are:
>> cat("\002scheme:(image (tuple (#",sep="")
>> flush(stdout())
>> system2("hexdump",args=c("-v","-e","'1/1
>> \"%02X\"'",op$file),stdout=stdout())
>> flush(stdout())
>> cat(") \"",format,"\") \"0.8par\" \"\" \"\" \"\")\005\n",sep="")
>>
>> which are pretty self-explanatory, except that "cat" will print its
>> arguments.
>>
>> This should produce:
>> \2scheme:(image (tuple (#
>> [now the hexdump]
>> ) "png") "0.8par" "" "" "")\5
>>
>> Do I do something wrong?
>
> If I remember well, then you should rather use the raw-data tag,
> if you want to directly use Scheme.

You mean that if I send data from the session to TeXmacs, it shouldn't
be in hex, i.e.
(#...)

That is also an option from the routine, and it gave even worse
errors. I'll try to debug that...

>
>> 2. This is actually a future improvement. But I'd like to be able to
>> insert a scheme for a function with its arguments. I.e. when the user
>> asks to insert a certain function into the input field, I'd like to
>> insert something like
>> function.name( argument1=[], argument2=[], .. )
>> so that the user can easily traverse between the arguments with the
>> left-right keys, i.e. the cursor starts within the [] of argument1,
>> and if I hit -> then I get into the [] of argument2, and so on. Is
>> something like this possible?
>
> Sure, you can override the behaviour of kbd-right and kbd-left
> when you are inside an R session. However, I would not recommend
> directly using -> and <- for this purpose, because users will
> have difficulties to move outside the brackets when needed.
> I rather suggest to overload the tab key to search for
> empty brackets [], before trying to do tab completion.
> Or use yet another keyboard shortcut for this purpose.

Sorry, I wasn't clear. I meant that what would be inserted in the
input field of the session would be a construct that maybe has fold
fields, or switch fields, or something like that, that makes it easy
for the user to jump between the fields, and at the same time also
seeing what argument he's editing. But I'm not yet sure if it is worth
it.
Currently, when the user selects a function from the R menu, it simply
inserts the function name into the input prompt.
But it would be better to insert the function with its arguments.
Something like:
print.default( x, digits = NULL, quote = TRUE, na.print = NULL,
print.gap = NULL,
right = FALSE, max = NULL, useSource = TRUE, ...)

But if I do that, then it is quite cumbersome to move between the
different arguments....
And, since the user would never have to edit, for example above, the
string "quote=" to something else, being able to move along the word
"quote=" char by char is useless. If the user would do any editing,
would be just deleting it altogether. So it would be nice if the whole
argument name would be just one thing that the user can easily jump
over.

Michael



Archive powered by MHonArc 2.6.19.

Top of Page