Hi,
I'm trying to use tm_dialog2 on a Bundle but I've run into a problem, while waiting (nib --wait) for user input TM will hang until I killall -9 tm_dialog2. It works fine on a shell though. The offending lines:
token = %x{"$DIALOG" nib --load ~/Desktop/Document --model '{document = {name = blah;};}'} print %x{"$DIALOG" nib --wait #{token}}
Maybe I didn't read all the available documentation, but I couldn't find any :\ Can anyone help me out on this one?
Thanks in advance.
Cumprimentos, António Afonso
On 24.01.2009, at 22:41, António Afonso wrote:
I'm trying to use tm_dialog2 on a Bundle but I've run into a problem, while waiting (nib --wait) for user input TM will hang until I killall -9 tm_dialog2. It works fine on a shell though. The offending lines:
token = %x{"$DIALOG" nib --load ~/Desktop/Document --model '{document = {name = blah;};}'} print %x{"$DIALOG" nib --wait #{token}}
Maybe I didn't read all the available documentation, but I couldn't find any :\ Can anyone help me out on this one?
Try to run your script in the background à la 'yourScript.rb &'
--Hans
I was actually hoping to have the script directly in the bundle command, nonetheless, I've put the code in an external file and changed the command to:
ruby ~/Desktop/bundle.rb &
Still no luck, I get the exact same behavior :( I forgot to tell you that I'm running Version 1.5.8 (1496) and just svn up'ed Tools, Support and PlugIns yesterday.
Cumprimentos, António Afonso
On Mon, Jan 26, 2009 at 08:07, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
On 24.01.2009, at 22:41, António Afonso wrote:
I'm trying to use tm_dialog2 on a Bundle but I've run into a problem, while waiting (nib --wait) for user input TM will hang until I killall -9 tm_dialog2. It works fine on a shell though. The offending lines:
token = %x{"$DIALOG" nib --load ~/Desktop/Document --model '{document = {name = blah;};}'} print %x{"$DIALOG" nib --wait #{token}}
Maybe I didn't read all the available documentation, but I couldn't find any :\ Can anyone help me out on this one?
Try to run your script in the background à la 'yourScript.rb &'
--Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 26.01.2009, at 21:02, António Afonso wrote:
I was actually hoping to have the script directly in the bundle command, nonetheless, I've put the code in an external file and changed the command to:
ruby ~/Desktop/bundle.rb &
try:
ruby ~/Desktop/bundle.rb &>/dev/null
to redirect STDOUT/STERR.
One also can run the script directly as tmcommand by wrapping it in a shell command by using an HERE doc.
--Hans
On Mon, Jan 26, 2009 at 21:31, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
On 26.01.2009, at 21:02, António Afonso wrote:
I was actually hoping to have the script directly in the bundle command, nonetheless, I've put the code in an external file and changed the command to:
ruby ~/Desktop/bundle.rb &
try:
ruby ~/Desktop/bundle.rb &>/dev/null
Same behavior
to redirect STDOUT/STERR.
One also can run the script directly as tmcommand by wrapping it in a
I don't think I understand what you mean.. like this?
ruby <<SCRIPT token = %x{"$DIALOG" nib --load ~/Desktop/Document --model '{document = {name = blah;};}'} %x{"$DIALOG" nib --wait #{token}} SCRIPT
same behavior again, as with this code:
token=`"$DIALOG" nib --load ~/Desktop/Document --model '{document = {name = blah;};}'}` "$DIALOG" nib --wait $token &
Cumprimentos, António Afonso
On 26.01.2009, at 21:45, António Afonso wrote:
On Mon, Jan 26, 2009 at 21:31, Hans-Jörg Bibiko bibiko@eva.mpg.de wrote:
try: ruby ~/Desktop/bundle.rb &>/dev/null
Same behavior
One also can run the script directly as tmcommand by wrapping it in a
I don't think I understand what you mean.. like this?
ruby <<SCRIPT token = %x{"$DIALOG" nib --load ~/Desktop/Document --model '{document = {name = blah;};}'} %x{"$DIALOG" nib --wait #{token}} SCRIPT
Yes. À la ruby <<SCRIPT &>/dev/null ... SCRIPT
but wait. You're using "$DIALOG" nib --load. The corrected --load (together with --dispose) command was introduced after TM build 1496. Thus, did you compiled DIALOG2 by yourself?
Type in an empty line: "$DIALOG" help window
and press CTRL+R. Do you see
window usage: "$DIALOG" window --load «nib» [«options»] "$DIALOG" window --update «token» [«options»] "$DIALOG" window --wait «token» "$DIALOG" window --close «token» "$DIALOG" window --list
if so please try --open instead of --load. The best would be to download the Dialog2 stuff (svn co http://svn.textmate.org/trunk/Tools/Dialog/) and compile it again and execute ' "$DIALOG" help window' to see the commands.
--Hans
but wait. You're using "$DIALOG" nib --load. The corrected --load (together with --dispose) command was introduced after TM build 1496. Thus, did you compiled DIALOG2 by yourself?
Type in an empty line: "$DIALOG" help window
and press CTRL+R. Do you see
window usage: "$DIALOG" window --load «nib» [«options»] "$DIALOG" window --update «token» [«options»] "$DIALOG" window --wait «token» "$DIALOG" window --close «token» "$DIALOG" window --list
if so please try --open instead of --load. The best would be to download the Dialog2 stuff (svn co http://svn.textmate.org/trunk/Tools/Dialog/) and compile it again and execute ' "$DIALOG" help window' to see the commands.
Are you sure? I thought it was actually the other way around, it was named window then renamed to nib, I remember updating my scripts because of that. I'm using Tools and PlugIns from svn, currently:
Dialog $ sudo svn up Password: At revision 11142.
Dialog $ svn log Commands/window.mm | head -n 5 ------------------------------------------------------------------------ r10952 | duff | 2008-12-04 11:11:41 +0100 (Thu, 04 Dec 2008) | 2 lines
?\226?\128?\162 change ?\226?\128?\152window?\226?\128?\153 command to ?\226?\128?\152nib?\226?\128?\153 and make the sub-commands be --load/--dispose instead of --open/--close.
$ tm_dialog2 help nib Displays custom dialogs from NIBs.
nib usage: "$DIALOG" nib --load «nib file» [«options»] "$DIALOG" nib --update «token» [«options»] "$DIALOG" nib --wait «token» "$DIALOG" nib --dispose «token» "$DIALOG" nib --list
Options: --center --model «plist» --prototypes «plist»
--Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Cumprimentos, António Afonso
On 26.01.2009, at 22:40, António Afonso wrote:
I thought it was actually the other way around, it was named window then renamed to nib, I remember updating my scripts because of that. I'm using Tools and PlugIns from svn, currently:
Dialog $ sudo svn up Password: At revision 11142.
Hmm. Then I would check whether your nib + script runs with DIALOG1. If not then check the nib, simplify your script/nib to figured out what's the problem is.
I can use DIALOG2 with my GetBundles script w/o any problems.
--Hans
I forgot: use wrap your wait command into Ruby's begin print %x{"$DIALOG" nib --wait #{token}} rescue print $! end
Maybe you see more.
--Hans
On 26 Jan 2009, at 21:02, António Afonso wrote:
I was actually hoping to have the script directly in the bundle command, nonetheless, I've put the code in an external file and changed the command to:
The best way is to model your command like this:
#!/usr/bin/env ruby -KU
require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/tm/detach"
TextMate.detach do # …your code here… end
This will properly detach the command (closing stdout/err) and if your command fails (exception) it will be presented in a nice dialog (now that stdout/err is gone).
Hmm. Then I would check whether your nib + script runs with DIALOG1. If not then check the nib, simplify your script/nib to figured out what's the problem is.
The best way is to model your command like this:
#!/usr/bin/env ruby -KU require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/tm/detach" TextMate.detach do # …your code here… end
This will properly detach the command (closing stdout/err) and if your command fails (exception) it will be presented in a nice dialog (now that stdout/err is gone).
I've created the simplest (I think) nib I can, just opened IB, created a window and saved it. With that in mind I did the following tests:
#!/usr/bin/env ruby -KU begin token = %x{"$DIALOG" nib --load ~/Desktop/Simple} print %x{"$DIALOG" nib --wait #{token}} rescue print $! end Same issue as before
#!/usr/bin/env ruby -KU require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/detach" TextMate.detach do token = %x{"$DIALOG" nib --open ~/Desktop/Simple} %x{"$DIALOG" nib --wait #{token}} end It looks like the block doesn't get executed, nothing happens at all...
#!/usr/bin/env ruby -KU %x{"$DIALOG_1" ~/Desktop/Simple 2&>1} Again, nothing happens, without the redirection (2&>1) it just hangs like it says in the help.
I have no problems in the command line though: $ "$DIALOG" nib --load ~/Desktop/Simple 33$ "$DIALOG" nib --wait 33 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>eventInfo</key> <dict> <key>type</key> <string>closeWindow</string> </dict> <key>model</key> <dict/> </dict> </plist>
It's probably some stupid mistake I'm doing :(
Cumprimentos, António Afonso
This might sound stupid, but could it be related to this issue somehow?
On 12 Jan 2009, at 17:17, Édouard Gilbert wrote:
I recently have run into troubles with Ciarán’s ProjectPlus plugin. It will simply prevent TM from launching. Console.app systematically reports the following :
The error you get is unrelated to ProjectPlus, it is because I (accidentally) only put a x86 build of the Dialog2 plug-in into latest edge build.
Édouard Gilbert
On 28 Jan 2009, at 00:38, António Afonso wrote:
I've created the simplest (I think) nib I can, just opened IB, created a window and saved it. With that in mind I did the following tests: [...] token = %x{"$DIALOG" nib --open ~/Desktop/Simple}
It’s --load, not --open.
I did the following command (using one of the bundled nibs):
#!/usr/bin/env ruby -KU require "#{ENV['TM_SUPPORT_PATH']}/lib/tm/detach" TextMate.detach do token = %x{"$DIALOG" nib --load RequestString} %x{"$DIALOG" nib --wait #{token}} %x{"$DIALOG" nib --dispose #{token}} raise "Done!" end
And it shows a input dialog (w/o stalling) and brings up an (exception) dialog when I dismiss the dialog.
On Fri, Jan 30, 2009 at 12:46, Allan Odgaard mailinglist@textmate.org wrote:
On 28 Jan 2009, at 00:38, António Afonso wrote:
I've created the simplest (I think) nib I can, just opened IB, created a window and saved it. With that in mind I did the following tests: [...] token = %x{"$DIALOG" nib --open ~/Desktop/Simple}
It's --load, not --open.
Ups, yes, sorry, I'd meant --load, somehow I wrote --open only on that snip of code... However, if I detach the script how can I return text to the bundle command? In this particular case I would like to "Show as Tool Tip" the output, but in the future I'd also want to "Replace *".
Thanks
-- Cumprimentos, António Afonso
On 31 Jan 2009, at 13:36, António Afonso wrote:
[...] if I detach the script how can I return text to the bundle command? In this particular case I would like to "Show as Tool Tip"
You can display tool tips via $DIALOG.
the output, but in the future I'd also want to "Replace *".
This is not possible, no. It is possible to insert text via $DIALOG, but it’s unsupported API — with Dialog1 you can open modal dialogs, and so you don’t need to detach, it’s something I deliberatly left out of Dialog2 both because the current commands using it did it only out of lazyness, and because the way it was implemented was dependent on how TM does things, which will change in the future, so it was not easy to make the plug-in work for present and future — so I figured if people really need it, they can use the old dialog API or make a really good case for why I should revisit the problem ;)
If you give some details about what you are creating, I might be able to suggest what the best approach is for you.