summaryrefslogtreecommitdiff
path: root/src/nsterm.m
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2011-08-14 12:39:38 +0200
committerJan Djärv <jan.h.d@swipnet.se>2011-08-14 12:39:38 +0200
commit08e3161a51ae1547c486d6603059711370d11118 (patch)
treee42b435b7f061f932bad860d2b2d1d0301fdd878 /src/nsterm.m
parent7417b37cce372cb5a04e06ebce999aa26f387002 (diff)
downloademacs-08e3161a51ae1547c486d6603059711370d11118.tar.gz
Fix that executing applescript may hang emacs uninterruptedly.
* nsfns.m (as_script, as_result, as_status): New static variables. (ns_run_ascript): New function. (Fns_do_applescript): Set variables as_*. Make an NSApplicationDefined event with data2 set to NSAPP_DATA2_RUNASSCRIPT, post it and then start the event loop. Get status from as_status. * nsterm.h (ns_run_ascript): Declare. (NSAPP_DATA2_RUNASSCRIPT): Define. * nsterm.m (sendEvent): If event is NSApplicationDefined and data2 is NSAPP_DATA2_RUNASSCRIPT, call ns_run_ascript and then exit the event loop (Bug#7276).
Diffstat (limited to 'src/nsterm.m')
-rw-r--r--src/nsterm.m10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index d4b1a3f8473..582e53e202c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4257,6 +4257,16 @@ ns_term_shutdown (int sig)
/* NSTRACE (sendEvent); */
/*fprintf (stderr, "received event of type %d\t%d\n", type);*/
+#ifdef NS_IMPL_COCOA
+ if (type == NSApplicationDefined
+ && [theEvent data2] == NSAPP_DATA2_RUNASSCRIPT)
+ {
+ ns_run_ascript ();
+ [self stop: self];
+ return;
+ }
+#endif
+
if (type == NSCursorUpdate && window == nil)
{
fprintf (stderr, "Dropping external cursor update event.\n");