texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Texmacs-dev] strange problem with pbpaste in OSX on Qt version of TeXma


From: Michael Lachmann
Subject: [Texmacs-dev] strange problem with pbpaste in OSX on Qt version of TeXmacs
Date: Wed, 27 Jul 2011 23:28:45 +0200

Hi!

I encountered a strange problem. As background, pbpaste is a command line 
utility on OSX that prints out the clipboard.

I discovered that when I call pbpaste from scheme: (shell "pbpaste"), the qt 
version of TeXmacs 1.0.7.9 gets stuck for a long time, whereas my old version 
of TeXmacs, the non-Qt version, doesn't. This only happens if copying was done 
in TeXmacs, but not if I copy from another program.

The same does not happen if I run a shell session inside TeXmacs and call 
pbpaste. 

I suspect that it is some kind of race condition. TeXmacs waits for the shell 
to complete, and TeXmacs owns the clipboard, so it is supposed to answer a 
query or some such. It is interesting that this only happens in the Qt version.


My problem is that I'm trying to write code that converts the clipboard to a 
different format, and then inserts it as the point.

The code looks like this:
---
(kbd-map ("R R ." 
          (shell "convert_pb2R.pl &")  ;; <-- look here
          (shell "sleep 5") ;; <- optional
          (clipboard-paste "primary")
          ))
--
The problem is this: if I don't fork the command convert_pb2R.pl, then TeXmacs 
gets stuck. 
If I do fork it, then TeXmacs doesn't get stuck. But, no matter how much I 
sleep in the next command, the convert command never finishes before the next 
command is issued . I suspect this is because the request to get the clipboard 
contents that is issued by convert_pb2R.pl is only answered AFTER everything 
finished. So, clipboard-paste always pastes the old contents.

Exactly the same worked on the old version of TeXmacs. It must be a difference 
in how the clipboard is handled.

Michael


reply via email to

[Prev in Thread] Current Thread [Next in Thread]