POST User-Agent: Xnntp/beta04 (PPC Mac OS 10.3)
Dear List,
I've recently discovered TextMate and am – so far - quite impressed because it integrates so well with the environment (vim and emacs don't [yet]) and still has some useful features and extensibility.
However, I have got two simple questions, to which I don't really find a good answer on the web (my fault, probably):
– I'm not sure who develops the R bundle; the highlighting is quite okay, the comments aren't (commenting uses C style by default; this doesn't work). I copied over the Python or Perl definitions (#) with the right scope marker. Is such a trivial change this worth asking for a svn account, or where should such suggestions be directed?
– One feature from Emacs' reftex mode (for LaTeX) I'd like to have in TextMate would be the recursive scanning for section commands, i.e. seeing all the sections etc. from the current master document and all (recursively) included files. Is this possible and I am to stupid to find it (perhaps using the wrong search terms)? This is an extremely practical thing for longer documents, because one can go from (the file containing) part I (or a file included by it) to a chapter in (the file containing) part III (or a file included by it).
Have a nice Labour Day, Cheers, Theorik
There is a label completion command, that will give you a popup of all the labels. It is not the same, but it does this recursive scanning you are talking about to find all labels. The code could be easily modified to pick out all the sections, and the txmt scheme could be used for the navigation part. If you feel like tinkering you can give it a try. Otherwise I will implement it in the summer when I have the time, unless someone beats me to it.
It's a great idea.
On May 1, 2006, at 5:22 AM, Theorik wrote:
– One feature from Emacs' reftex mode (for LaTeX) I'd like to have in TextMate would be the recursive scanning for section commands, i.e. seeing all the sections etc. from the current master document and all (recursively) included files. Is this possible and I am to stupid to find it (perhaps using the wrong search terms)? This is an extremely practical thing for longer documents, because one can go from (the file containing) part I (or a file included by it) to a chapter in (the file containing) part III (or a file included by it).
Have a nice Labour Day, Cheers, Theorik
Haris
On 1-5-2006, 15:27, Charilaos Skiadas wrote:
There is a label completion command, that will give you a popup of all the labels. It is not the same, but it does this recursive scanning you are talking about to find all labels. The code could be easily modified to pick out all the sections, and the txmt scheme could be used for the navigation part. If you feel like tinkering you can give it a try. Otherwise I will implement it in the summer when I
Oh, thank you very much; this sounds interesting (but I'm not sure I'll have time right now, either). This would mean generating an "HTML" window from where you can access Sections etc? It sounds like an interesting first try at customising TextMate...
From what I read in the manual, it does not seem to be possible to include this into the regular symbol list, as there seems no way of executing commands there – so the only possibility I see would be extending the grammar to recognise certain comments and provide a command for generating these comments (which would be generated by recursively parsing the includes etc.). Am I right there ? (And this sounds like an awful hack, doesn't it?)
have the time, unless someone beats me to it.
Maybe I should try, because I brought it up...
It's a great idea.
Yes, one of the main reasons I've used Emacs for so long ;-)
Thanks again for the hint, cheers, Theorik
On May 1, 2006, at 9:22 AM, Theorik wrote:
This would mean generating an "HTML" window from where you can access Sections etc? It sounds like an interesting first try at customising TextMate...
Exactly how it would work, yes. The command would have output set to HTML, and would generate a list of links with hrefs of the form txmt://open..... The other approach would be to create a plugin like tmcodebrowser, that has a nice floating window out there, and models what tmcodebrowser is doing, but doing a manual parse instead of using ctags.
From what I read in the manual, it does not seem to be possible to include this into the regular symbol list, as there seems no way of executing commands there – so the only possibility I see would be extending the grammar to recognise certain comments and provide a command for generating these comments (which would be generated by recursively parsing the includes etc.). Am I right there ? (And this sounds like an awful hack, doesn't it?)
The grammar already recognizes certain comments and adds them to the symbols list, namely "TeXshop style" comments starting with %: So: %: hello should add "hello" in the symbols list. The impossible task in this case is to have those symbols link to other files, ASAICT.
Btw, I don't know who is maintaining the R bundle, but I was planning to work a lot on it during the summer, so I will add proper handling of comments at that point, again if noone beats me to it.
Haris
On 1/5/2006, at 16:54, Charilaos Skiadas wrote:
This would mean generating an "HTML" window from where you can access Sections etc? It sounds like an interesting first try at customising TextMate...
Exactly how it would work, yes. The command would have output set to HTML, and would generate a list of links with hrefs of the form txmt://open.....
An example of this can be found in the TODO bundle (Show TODO List).
Btw, I don't know who is maintaining the R bundle, but I was planning to work a lot on it during the summer, so I will add proper handling of comments at that point, again if noone beats me to it.
I’ve received a few updates from Jon Clayden, but there is no official maintainer. I’ll add that comment-thing :)
Scripsit Allan Odgaard diē 1.5.2006 17:02:
On 1/5/2006, at 16:54, Charilaos Skiadas wrote:
This would mean generating an "HTML" window from where you can access Sections etc? It sounds like an interesting first try at customising TextMate...
Exactly how it would work, yes. The command would have output set to HTML, and would generate a list of links with hrefs of the form txmt://open.....
An example of this can be found in the TODO bundle (Show TODO List).
Thanks very much, Charilaos and Allan, I'll have a look at txmt: and "Show TODO List". I noticed that too many symbols in the symbol menu are rather confusing, anyway. So a separate table of contents window makes a lot of sense.
Btw, I don't know who is maintaining the R bundle, but I was planning to work a lot on it during the summer, so I will add proper handling of comments at that point, again if noone beats me to it.
I’ve received a few updates from Jon Clayden, but there is no official maintainer. I’ll add that comment-thing :)
Thanks again!
Cheers, Bernhard
On May 1, 2006, at 3:22 AM, Theorik wrote:
– I'm not sure who develops the R bundle; the highlighting is quite okay, the comments aren't (commenting uses C style by default; this doesn't work). I copied over the Python or Perl definitions (#) with the right scope marker. Is such a trivial change this worth asking for a svn account, or where should such suggestions be directed?
I'm not sure if anybody is actively maintaining the R bundle. I did the exact same thing to the commenting and it's a nice improvement.
Since you're using R and LaTeX, do you by any chance also use Sweave? If so, I have a mostly-working Sweave bundle that I'd love to share and get a second set of eyes on.
-Alan
Scripsit Alan Schussman die- 1.5.2006 17:15:
On May 1, 2006, at 3:22 AM, Theorik wrote:
– I'm not sure who develops the R bundle; the highlighting is quite okay, the comments aren't (commenting uses C style by default; this doesn't work). I copied over the Python or Perl definitions (#) with the right scope marker. Is such a trivial change this worth asking for a svn account, or where should such suggestions be directed?
I'm not sure if anybody is actively maintaining the R bundle. I did the exact same thing to the commenting and it's a nice improvement.
Since you're using R and LaTeX, do you by any chance also use Sweave? If so, I have a mostly-working Sweave bundle that I'd love to share and get a second set of eyes on.
No, I don't use Sweave – though now that I know about it – thanks! –, I wonder whether I should ;-) But anyway, I won't be of any help for you yet, I suppose; sorry.
Bernhard
I'm not sure if anybody is actively maintaining the R bundle. I did the exact same thing to the commenting and it's a nice improvement.
Well, I guess I'm passively maintaining the R bundle. I had basically everything I needed, but if you have any suggestions for improvement, I'm happy to add them.
Since you're using R and LaTeX, do you by any chance also use Sweave? If so, I have a mostly-working Sweave bundle that I'd love to share and get a second set of eyes on.
That would be great. I use sweave from time to time too, and I think I may have a partially written sweave language file too.
Hadley
I would love to see function completion like the mac GUI for R has; so, I would type "glm(" and somewhere I get information on what the input for glm looks like. With R, because it is user-contributed functions, input is not standardized and this would be a handy feature. Do people think this would be useful?
Jeff.
On May 1, 2006, at 6:11 PM, hadley wickham wrote:
I'm not sure if anybody is actively maintaining the R bundle. I did the exact same thing to the commenting and it's a nice improvement.
Well, I guess I'm passively maintaining the R bundle. I had basically everything I needed, but if you have any suggestions for improvement, I'm happy to add them.
Since you're using R and LaTeX, do you by any chance also use Sweave? If so, I have a mostly-working Sweave bundle that I'd love to share and get a second set of eyes on.
That would be great. I use sweave from time to time too, and I think I may have a partially written sweave language file too.
Hadley
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On May 1, 2006, at 5:39 PM, Jeffrey Robert Spies wrote:
I would love to see function completion like the mac GUI for R has; so, I would type "glm(" and somewhere I get information on what the input for glm looks like. With R, because it is user-contributed functions, input is not standardized and this would be a handy feature. Do people think this would be useful?
Some more things I'd like to see: 1) Be able to run the whole file and see the output in a nice html window, like it happens with Ruby. I've tried to make that work, but was unable to. 1+) Extra points for producing a list of links to all images created during the session. 2) Instant tooltip help on current word. 3) (Ideally, via a plugin probably) Be able to have a "session" with R, i.e. type commands and have their result appear. Each pressing of "return" should execute the current line in a running version of R, and insert the output on the next line. 4) Function name completion, for standard functions as well as packages installed and loaded in current file. 5) Snippets for -> and <- 6) Syntax check, if possible. 7) Ability to run the program up to current line, and evaluate current selection in that context, and show result in tooltip.
Number 1 is the most pressing one for me. Theoretically all these should be done via interaction with the command-line version of R, but I haven't been able to find the best mode that would do that. I'm guessing one should look at what ESS is doing and try to do something similar.
Jeff.
Haris
On 5/1/06, Charilaos Skiadas cskiadas@uchicago.edu wrote:
Some more things I'd like to see:
- Be able to run the whole file and see the output in a nice html
window, like it happens with Ruby. I've tried to make that work, but was unable to. 1+) Extra points for producing a list of links to all images created during the session. 2) Instant tooltip help on current word.
This would be great, do any other language bundles have a similar feature? I'd like to be able to get any help on the selected word, preferably the local (harddrive) help but the web would be fine.
- (Ideally, via a plugin probably) Be able to have a "session" with
R, i.e. type commands and have their result appear. Each pressing of "return" should execute the current line in a running version of R, and insert the output on the next line.
This shouldn't be too difficult, there is a shell command for running R code. R CMD BATCH.
- Function name completion, for standard functions as well as
packages installed and loaded in current file. 5) Snippets for -> and <-
You can make these yourself. I did for '<-' which I assigned to space-tab. I rarely use '->' except interactively. What other snippets have people written for R?
- Syntax check, if possible.
I imagine this would be difficult because each package can have different syntax requirement, can you be more specific by what you are looking for?
- Ability to run the program up to current line, and evaluate
current selection in that context, and show result in tooltip.
Number 1 is the most pressing one for me. Theoretically all these should be done via interaction with the command-line version of R, but I haven't been able to find the best mode that would do that. I'm guessing one should look at what ESS is doing and try to do something similar.
I would like a quicker way to send the current selection to R.app. I don't know if this is possible, but the current method can be sluggish for longer scripts.
I also modified the language definition to include parenthesis for folding as often my plot command span several lines and it's nice to hide them.
Peter
On May 1, 2006, at 4:55 PM, Peter Cowan wrote:
You can make these yourself. I did for '<-' which I assigned to space-tab. I rarely use '->' except interactively. What other snippets have people written for R?
I've done the same, but assigned it to _, which comes from ESS.
I would like a quicker way to send the current selection to R.app. I don't know if this is possible, but the current method can be sluggish for longer scripts.
I use the following for long selections of code. It seems R.app doesn't always handle lots of code well. This command saves the selected code to a temp file and then source()s it in R. It's a bit roundabout, but works great.
echo "$TM_SELECTED_TEXT" > /tmp/Rcmd.txt osascript -e 'tell application "R" to activate' -e "tell application "R" to cmd "source('/tmp/Rcmd.txt', echo=TRUE)""
-Alan
On May 1, 2006, at 6:55 PM, Peter Cowan wrote:
On 5/1/06, Charilaos Skiadas cskiadas@uchicago.edu wrote:
- Be able to run the whole file and see the output in a nice html
window, like it happens with Ruby. I've tried to make that work, but was unable to. 2) Instant tooltip help on current word.
This would be great, do any other language bundles have a similar feature? I'd like to be able to get any help on the selected word, preferably the local (harddrive) help but the web would be fine.
I was thinking of just the information that is provided when you type ?cmd in R. Not sure if other bundles have something like this, maybe the obj-c one does.
- (Ideally, via a plugin probably) Be able to have a "session" with
R, i.e. type commands and have their result appear. Each pressing of "return" should execute the current line in a running version of R, and insert the output on the next line.
This shouldn't be too difficult, there is a shell command for running R code. R CMD BATCH.
Well, you do need to somehow keep it running in the background and interact with it. I haven't been able to do that in a nice way. I think R CMD BATCH might be more closely to what i am talking about in question 1. Problem is, I found no way to tell it to output the information to standard output instead of another file, unless I've missed something. See, what I want is to have R execute each command and return me the output so that I can start showing it, instead of running the entire program and then showing all the output. Exactly what happens with tmruby.
- Syntax check, if possible.
I imagine this would be difficult because each package can have different syntax requirement, can you be more specific by what you are looking for?
Not sure really, just threw it there as an idea. I am not far into it to packages yet, so I was really thinking of the standard commands. But I guess this is in part provided by the syntax highlighting.
I would like a quicker way to send the current selection to R.app. I don't know if this is possible, but the current method can be sluggish for longer scripts.
I just don't want to even have R.app running, ideally. Most work should be doable from within TM, that's what (3) above is intended for. But it just seems to me that R does not provide, at least it is not clear to me if it does, enough functionality to support programs hooking on to it and becoming its front-ends. But I must say I haven't spent much time with it yet.
I also modified the language definition to include parenthesis for folding as often my plot command span several lines and it's nice to hide them.
Peter
Haris
On May 1, 2006, at 6:55 PM, Peter Cowan wrote:
- (Ideally, via a plugin probably) Be able to have a "session" with
R, i.e. type commands and have their result appear. Each pressing of "return" should execute the current line in a running version of R, and insert the output on the next line.
This shouldn't be too difficult, there is a shell command for running R code. R CMD BATCH.
Well, you do need to somehow keep it running in the background and interact with it. I haven't been able to do that in a nice way. I think R CMD BATCH might be more closely to what i am talking about in question 1. Problem is, I found no way to tell it to output the information to standard output instead of another file, unless I've missed something. See, what I want is to have R execute each command and return me the output so that I can start showing it, instead of running the entire program and then showing all the output. Exactly what happens with tmruby.
I'm not too savvy with writing commands yet, but perhaps R --slave can do what you want. It writes to standard output. Every time it is called might be a new instance of R though, which would be problematic for evaluating previously assigned function etc. I also don't know how it handles figures.
Peter
On May 2, 2006, at 1:02 PM, Peter Cowan wrote:
I'm not too savvy with writing commands yet, but perhaps R --slave can do what you want. It writes to standard output. Every time it is called might be a new instance of R though, which would be problematic for evaluating previously assigned function etc. I also don't know how it handles figures.
R --slave does get rid of the ">" in front, so that could be helpful. But my problem is with keeping an interactive connection with R. I am trying to do it in Ruby using popen, but the problem that I have is that the input and output pipes don't really work simultaneously. I.e. I'd like to be able to write a single line to input, then read all the output, then send another line etc. The regular pipes in Ruby don't seem to be able to do that, and I really don't have the time right now to figure out another way.
Peter
Haris
On 5/2/06, Charilaos Skiadas cskiadas@uchicago.edu wrote:
On May 2, 2006, at 1:02 PM, Peter Cowan wrote:
I'm not too savvy with writing commands yet, but perhaps R --slave can do what you want. It writes to standard output. Every time it is called might be a new instance of R though, which would be problematic for evaluating previously assigned function etc. I also don't know how it handles figures.
R --slave does get rid of the ">" in front, so that could be helpful. But my problem is with keeping an interactive connection with R. I am trying to do it in Ruby using popen, but the problem that I have is that the input and output pipes don't really work simultaneously. I.e. I'd like to be able to write a single line to input, then read all the output, then send another line etc. The regular pipes in Ruby don't seem to be able to do that, and I really don't have the time right now to figure out another way.
You can fake it by doing 'R --save --restore --slave' which saves a .Rdata file with stored functions and variables and restores whatever one it can find. There of course can be side effects if a workspace exists from a previous use.
Oh, btw for getting tooltip help you can use this command and send the output to a tooltip:
printf "?$TM_SELECTED_TEXT" | R --slave
Or when you said instant, did you intend mouse hovering to bring up the tooltip?
Peter
On May 2, 2006, at 8:26 PM, Peter Cowan wrote:
You can fake it by doing 'R --save --restore --slave' which saves a .Rdata file with stored functions and variables and restores whatever one it can find. There of course can be side effects if a workspace exists from a previous use.
The side effects here would really be very undesirable, I think. Plus, this does not solve my main problem, of accessing the file real- time, as it is being written, from within Ruby.
printf "?$TM_SELECTED_TEXT" | R --slave
Or when you said instant, did you intend mouse hovering to bring up the tooltip?
No, that's what I meant. Of course, TM_SELECTED_TEXT might not be the right thing, even if it falls back to "word", since R allows commands like help.start which are not "words" in TextMate. So, the command should scan the current line for the "R command under the cursor". And ideally there would be two commands, one bound to ctrl-/ and doing exactly the tooltip thing, and another, perhaps bound to ctrl- shift-/, that would open up the online help on the word or something like that.
Peter
Haris
On 5/2/06, Charilaos Skiadas cskiadas@uchicago.edu wrote:
On May 2, 2006, at 8:26 PM, Peter Cowan wrote:
You can fake it by doing 'R --save --restore --slave' which saves a .Rdata file with stored functions and variables and restores whatever one it can find. There of course can be side effects if a workspace exists from a previous use.
The side effects here would really be very undesirable, I think. Plus, this does not solve my main problem, of accessing the file real- time, as it is being written, from within Ruby.
Yes, I agree there could be bad side effects. Btw the default behavior is to load the last saved workspace.
I guess I don't fully understand what you'd like to do, but you might find the following useful:
http://www.approximity.com/cgi-bin/blogtari/index.rb/Tools/R@RubybindingsforR.txt
Ruby, isn't my thing so I cannot assess the quality or completeness.
Peter
On May 3, 2006, at 12:46 PM, Peter Cowan wrote:
On 5/2/06, Charilaos Skiadas cskiadas@uchicago.edu wrote: Yes, I agree there could be bad side effects. Btw the default behavior is to load the last saved workspace.
I guess I don't fully understand what you'd like to do, but you might find the following useful:
<http://www.approximity.com/cgi-bin/blogtari/index.rb/Tools/ R@RubybindingsforR.txt>
Ruby, isn't my thing so I cannot assess the quality or completeness.
thanks, though this is something different, it is to call R methods from within Ruby code. I am just using Ruby to write the TextMate command. My confusion came from misunderstanding how the Ruby run command works. For instance if you start a new document, set the language to Ruby, and type in the following:
print "Hello " sleep 5 print "there"
and then press cmd-R, then you see a nice html window saying "Hello there". what I thought would be happening would be to see "Hello ", and then 5 seconds later see "there". I.e. I thought each line that was executed had its output produced and shown in the window, instead of having to wait for it to finish. I wanted a similar thing from R, which I now see is not possible. So I just added a command that does the same thing as the "Ruby script" command, i.e. it feeds the current document into the command- line R program, and prints the output in an HTML window. It has had very little testing, but hopefully it's a place to start. I essentially just copied the command from RubyMate.
Peter
Haris
On 3/5/2006, at 3:26, Peter Cowan wrote:
[...] Oh, btw for getting tooltip help you can use this command and send the output to a tooltip:
printf "?$TM_SELECTED_TEXT" | R --slave
Printf will check the string for placeholders (like %s, %d), and escape sequences (like \n, \033).
So you probably want:
echo "?$TM_SELECTED_TEXT" | R --slave
Or to use a here-string:
R <<<"?$TM_SELECTED_TEXT" --slave
These two though provide the input with a newline. For echo it can be avoided using -n as argument switch.
On May 1, 2006, at 3:11 PM, hadley wickham wrote:
That would be great. I use sweave from time to time too, and I think I may have a partially written sweave language file too.
I put my starter sweave bundle at http://textbench.com/tm/ sweave.tar.gz. It includes a file called info.txt that briefly describes it. It's my first bundle, and I started putting it together when I was brand new to TextMate, so it probably does some things in a silly or nonstandard way. I'd love to see it improved.
I like both Jeffrey's and Haris's suggestions for the R bundle. It's neat to see more interest in it percolating around and I'm looking forward to contributing where I can.
-Alan