[TxMt] Solution for cut to end of line (emacs ctrl-k)?

Allan Odgaard allan at macromates.com
Wed Jan 19 10:10:44 UTC 2005


On Jan 19, 2005, at 1:29, Brad Miller wrote:

> Sadly, when I run the pbpaste command I just get a spinning beach ball 
> for about 30 seconds and then nothing gets pasted.

hmm... yes... problem is that when TextMate claims ownership of the 
clipboard, all others need to ask TM for the contents, but TM is busy 
asking pbpaste for the command result.

But if you make ctrl-k write to the normal clipboard, ctrl-y should 
just be re-bound to cmd-v!?!

> I tried running pbpaste from the command line, just to see if the 
> pbcopy part was working, and the copy part appears to work when I 
> create the macro, but when I test it it does not work anymore.  It 
> does not seem like the selectToEnd of line part is working....

Come to think of it, the problem is probably the same as to when not 
using pbcopy (local clipboard in macros).

I did a little bit of experimenting, and I can make it work if I let 
the macro execute this command (input: selection, output: discard):

tmp=`mktemp -t tm_clip`; cat >$tmp; { sleep .2; pbcopy <$tmp; rm $tmp; 
} >/dev/null 2>&1 </dev/null &

What it does is first store selection in a file, then asynchronously 
sleep for .2 seconds and _then_ copy the file contents to the clipboard 
(so that should be after TM thinks the macro is done, and thus after TM 
resets the clipboard).

I admit, it's not very elegant...




More information about the textmate mailing list