[TxMt] R bundle: Command Usage

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Jan 3 18:06:27 UTC 2007


On 03.01.2007, at 18:23, Charilaos Skiadas wrote:

> On Jan 3, 2007, at 11:02 AM, Hans-Joerg Bibiko wrote:
>
>> Hi Kevin,
>>
>>
>> On 24 Dec 2006, at 23:20, Kevin Ballard wrote:
>>
>>> What is texscan? I never knew that, so I always just ignored the  
>>> command ;)
>>>
>
> Actually, it was tex.scan, which is a simple ruby command scanning  
> the string given by the variable tex. I think Kevin by accident  
> mistyped it. (You can see the revision diff).
>
> What a difference a dot makes, eh?
>

OK. I changed it and now tex.scan works. (Actually I was a bit blind,  
the one thing I had to do is to read the ruby code ;) )

> I like the command too, though I don't really use it much at this  
> point, (need to open the actual help file most of the times). I  
> wrote the command originally, and looking at the revision history  
> of the command would show that it was tex.scan. Does it work as  
> expected if you make that change? If so, I don't really see the  
> advantage of parsing the HTML file instead.

Well, my HTML scan approach is to output everything which is written  
within the 'Usage' block.

Example:

#####################
'difftime'

tex.scan output:
_________________
time1 - time2

html output:
_________________
Usage:

time1 - time2

difftime(time1, time2, tz = "",
          units = c("auto", "secs", "mins", "hours", "days", "weeks"))

as.difftime(tim, format = "%X")

## S3 method for class 'difftime':
round(x, digits = 0)

#####################
'matrix'
tex.scan output:
_________________
matrix(data = NA, nrow = 1, ncol = 1, byrow = FALSE,      (??)

html output:
_________________
Usage:

matrix(data = NA, nrow = 1, ncol = 1, byrow = FALSE,
        dimnames = NULL)

as.matrix(x)

is.matrix(x)


Well, the question is what does the user expect by using 'Command Usage'

By my opinion the tex.scan version is very similar to the Kevin's  
'Insert Command Template'. So I would suggest to use the HTML version  
instead. This is a bit more informative.

On the other hand if we decide to use the tex.scan version then it  
would be better to change the line

file = `find "${R_HOME:-/Library/Frameworks/R.framework/Resources}"/ 
library -name #{text}.tex -print`

into

file = `find "${R_HOME:-/Library/Frameworks/R.framework/Resources}"/ 
library -name #{text}.tex -print 2>/dev/null`

to speed up it a bit

  and

we have to fix the 'bug' for matrix(), for instance, to display the  
whole definition.

Best,
-Hans





More information about the textmate mailing list