summaryrefslogtreecommitdiff
path: root/src/haikuselect.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-05-15 08:33:34 +0000
committerPo Lu <luangruo@yahoo.com>2022-05-15 08:33:34 +0000
commitaaa2d0db18509b7d2f1e35cbc9dc2b4443f1cce4 (patch)
treeb04ec55ac188fd23cfe542c87495948b7f2c60b1 /src/haikuselect.c
parent99df11a393e5ba39cb2dc93e5a01de69ae18e91a (diff)
downloademacs-aaa2d0db18509b7d2f1e35cbc9dc2b4443f1cce4.tar.gz
Improve return value of `haiku-roster-launch'
* src/haikuselect.c (Fhaiku_roster_launch): Return `already-running' if no PID is available since the target application is already running. (syms_of_haikuselect): New defsym.
Diffstat (limited to 'src/haikuselect.c')
-rw-r--r--src/haikuselect.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/haikuselect.c b/src/haikuselect.c
index 0c808bdb937..f7618aa4db5 100644
--- a/src/haikuselect.c
+++ b/src/haikuselect.c
@@ -778,8 +778,9 @@ ignored if it is dropped on top of FRAME. */)
DEFUN ("haiku-roster-launch", Fhaiku_roster_launch, Shaiku_roster_launch,
2, 2, 0,
doc: /* Launch an application associated with FILE-OR-TYPE.
-Return the process ID of the application, or nil if no application was
-launched.
+Return the process ID of any process created, the symbol
+`already-running' if ARGS was sent to a program that's already
+running, or nil if launching the application failed.
FILE-OR-TYPE can either be a string denoting a MIME type, or a list
with one argument FILE, denoting a file whose associated application
@@ -850,9 +851,16 @@ after it starts. */)
&team_id);
unblock_input ();
+ /* `be_roster_launch' can potentially take a while in IO, but
+ signals from async input will interrupt that operation. If the
+ user wanted to quit, act like it. */
+ maybe_quit ();
+
if (rc == B_OK)
return SAFE_FREE_UNBIND_TO (depth,
make_uint (team_id));
+ else if (rc == B_ALREADY_RUNNING)
+ return Qalready_running;
return SAFE_FREE_UNBIND_TO (depth, Qnil);
}
@@ -913,6 +921,7 @@ used to retrieve the current position of the mouse. */);
DEFSYM (Qsize_t, "size_t");
DEFSYM (Qssize_t, "ssize_t");
DEFSYM (Qpoint, "point");
+ DEFSYM (Qalready_running, "already-running");
defsubr (&Shaiku_selection_data);
defsubr (&Shaiku_selection_put);