I made this little command to search for examples of programming libraries / construct:
#!/usr/bin/env python import webbrowser from os import environ
lang = environ['TM_MODE'].lower() QUERY="http://google.com/codesearch?q=" + environ['TM_CURRENT_WORD'] + "++lang:" + lang webbrowser.open_new(QUERY)
It works fine, do you see any possible "problem"? Could I maybe use the browser integrated inside Textmate?? How to call it directly?
Another little thing: I read on the dev guide that I should modify directly bundles and the svn diff to view my changes. Actually I'm not doing like that but I have all my changes in the "normal" directory.
How is better to do to propose changes or some new features to bundles mainatainers?
Thanks
On 2 Jan 2009, at 15:50, Andrea Crotti wrote:
[...] lang = environ['TM_MODE'].lower() [...] It works fine, do you see any possible "problem"?
Other than use of the deprecated TM_MODE, no. But in your case the use seems justified, I’ll have to re-evaluate scrapping that variable.
Could I maybe use the browser integrated inside Textmate?? How to call it directly?
Simply set your command to have HTML output, and it’ll open the “browser” with your commands output as content. What you want is then to have your command output a <meta> tag with a redirect to the actual page (i.e. the Google search URL).
Another little thing: I read on the dev guide that I should modify directly bundles and the svn diff to view my changes. Actually I'm not doing like that but I have all my changes in the "normal" directory.
How is better to do to propose changes or some new features to bundles mainatainers?
If you have a patch to submit, then see http://wiki.macromates.com/Bundles/HowToContribute
If you have suggestions (no code) then write your suggestion here or at the ##textmate IRC channel.
Allan Odgaard-4 wrote:
On 2 Jan 2009, at 15:50, Andrea Crotti wrote:
[...] lang = environ['TM_MODE'].lower() [...] It works fine, do you see any possible "problem"?
Other than use of the deprecated TM_MODE, no. But in your case the use seems justified, I’ll have to re-evaluate scrapping that variable.
I think the mode variable could be useful sometimes, and they are not so many, are there good reasons to take away some of them?
Allan Odgaard-4 wrote:
Simply set your command to have HTML output, and it’ll open the “browser” with your commands output as content. What you want is then to have your command output a <meta> tag with a redirect to the actual page (i.e. the Google search URL).
Ok I tried with this #!/usr/bin/env python import webbrowser import urllib2 from os import environ
lang = environ['TM_MODE'].lower() QUERY="http://google.com/codesearch?q=" + environ['TM_CURRENT_WORD'] + "++lang:" + lang print urllib2.urlopen(QUERY).read()
And it works, but it stops working at the first click, maybe not supporting frames or whatever it is in the details page of the source snippets?
Allan Odgaard-4 wrote:
If you have a patch to submit, then see http://wiki.macromates.com/Bundles/HowToContribute
If you have suggestions (no code) then write your suggestion here or at the ##textmate IRC channel.
Ok but now I'm working in my working directory (Bundles) with the default updated via svn (BTW is it normal we're still at revision 10740 since a long time?) in Pristine Copy/Bundles.
This is the way suggested on the manual which is different from the way suggested for developers.. So what should I do, merge everything in the Bundles folder? (and how?)
Some "suggestions", I love TM so I'd like to get it perfect: I think it would be really nice to use a distributed control system like darcs (http://darcs.net/) instead of svn, in such a "distributed" project we could have many nice features.
Frames (maybe already discussed) like in emacs or vim are very useful, I didn't find any nice way to use them. Maybe also giving some more controls to the window positions would be useful also.
And for last thing I would really love to get a small line of input to launch shell commands directly inside TM, useful whenever you need to launch something but you don't care about the output. I know here it's everything is minimal (and that's why it's fantastic), but it could be just activated with some key as the incremental search is, not really annoying.
The default behaviour could be show as tool tip only if you get some errors.
On 6 Jan 2009, at 09:42, Andrea Crotti wrote:
[...] Other than use of the deprecated TM_MODE, no. But in your case the use seems justified, I’ll have to re-evaluate scrapping that variable.
I think the mode variable could be useful sometimes, and they are not so many, are there good reasons to take away some of them?
The TM_MODE variable is the display name of the currently selected grammar, which can technically be anything and does not reflect how languages can be embedded into each other (e.g. you can have HTML in Ruby, JavaScript in HTML, SQL in PHP, etc.).
The TM_SCOPE variable shows the actual context but a more elegant solution is to introduce a variable a la TM_CODE_SEARCH_TERM and set this to the proper term for the various scopes.
Simply set your command to have HTML output, and it’ll open the “browser” with your commands output as content. What you want is then to have your command output a <meta> tag with a redirect to the actual page (i.e. the Google search URL).
Ok I tried with this #!/usr/bin/env python import webbrowser import urllib2 from os import environ
lang = environ['TM_MODE'].lower() QUERY="http://google.com/codesearch?q=" + environ['TM_CURRENT_WORD'] + "++lang:" + lang print urllib2.urlopen(QUERY).read()
And it works, but it stops working at the first click, maybe not supporting frames or whatever it is in the details page of the source snippets?
This is because you output the actual page source from the command, if you want to do that, you need to insert a <base> tag so that relative links resolve properly.
But the better approach is to do something like:
print "<meta http-equiv='Refresh' content='0;URL=%s'>" % QUERY
[...] (BTW is it normal we're still at revision 10740 since a long time?) in Pristine Copy/Bundles.
If you refer to the version of the repository, no, but it moved to: http://svn.textmate.org/trunk/
This is the way suggested on the manual which is different from the way suggested for developers.. So what should I do, merge everything in the Bundles folder? (and how?)
I don’t follow your setup. But if you plan to submit patches you want to svn co the bundle you want to contribute to to ~/Library/ Application Support/TextMate/Bundles so that TextMate does not create delta files.
I think it would be really nice to use a distributed control system like darcs (http://darcs.net/) instead of svn, in such a "distributed" project we could have many nice features.
There is a github mirror of the svn repository: http://github.com/kballard/textmate-bundles/tree
And for last thing I would really love to get a small line of input to launch shell commands directly inside TM, useful whenever you need to launch something but you don't care about the output. I know here it's everything is minimal (and that's why it's fantastic), but it could be just activated with some key as the incremental search is, not really annoying.
The default behaviour could be show as tool tip only if you get some errors.
You can easily make such command yourself — if you have the interactive input library (included in latest cutting edge) you can simply make the command read from stdin for what to execute (rather than use DIALOG directly or via lib/ui.rb).