[TxMt] CocoaDialog stalls with stdin

Allan Odgaard throw-away-1 at macromates.com
Thu Mar 30 10:35:59 UTC 2006


On 29/3/2006, at 23:15, Quinn Comendant wrote:

> [...] The "Search mailing list" command lets you go to other  
> windows, copy
> some text, then go back to the dialog box and paste text in. It works
> perfect. Mind doesn't.

The difference is that the Search ML has output set as HTML. When  
that is the case, the command is running asynchronously. With New  
Document as output option, TM will stall until the command has  
completed.

You could make the command asynchronous by wrapping it in something  
like: { … } &>/dev/null &

But then the command itself should create the new document (and  
output should just be discard). For example one could (probably) use  
this:

{ res=$(CocoaDialog inputbox \
     --title "Find matching lines" \
     --informative-text "Regular expression to match lines:" \
     --button1 "Find" --button2 "Cancel")

   [[ $(head -n1 <<<"$res") == "2" ]] && exit_discard
   pattern=$(tail -n1 <<<"$res")

   TMP="$(mktemp /tmp/tm_search_XXXXXXXX).${TM_FILENAME##*.}"
   perl >"$TMP" -ne "print if /$pattern/"
   mate "$TMP"

} &>/dev/null &


Btw: anyway to get your mailer to not enumerate the replies in the  
subject? it messes up the threading in Mail.




More information about the textmate mailing list