aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-05-15 08:33:34 +0000
committerPo Lu2022-05-15 08:33:34 +0000
commitaaa2d0db18509b7d2f1e35cbc9dc2b4443f1cce4 (patch)
treeb04ec55ac188fd23cfe542c87495948b7f2c60b1 /src
parent99df11a393e5ba39cb2dc93e5a01de69ae18e91a (diff)
downloademacs-aaa2d0db18509b7d2f1e35cbc9dc2b4443f1cce4.tar.gz
emacs-aaa2d0db18509b7d2f1e35cbc9dc2b4443f1cce4.zip
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')
-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. */)
778DEFUN ("haiku-roster-launch", Fhaiku_roster_launch, Shaiku_roster_launch, 778DEFUN ("haiku-roster-launch", Fhaiku_roster_launch, Shaiku_roster_launch,
779 2, 2, 0, 779 2, 2, 0,
780 doc: /* Launch an application associated with FILE-OR-TYPE. 780 doc: /* Launch an application associated with FILE-OR-TYPE.
781Return the process ID of the application, or nil if no application was 781Return the process ID of any process created, the symbol
782launched. 782`already-running' if ARGS was sent to a program that's already
783running, or nil if launching the application failed.
783 784
784FILE-OR-TYPE can either be a string denoting a MIME type, or a list 785FILE-OR-TYPE can either be a string denoting a MIME type, or a list
785with one argument FILE, denoting a file whose associated application 786with one argument FILE, denoting a file whose associated application
@@ -850,9 +851,16 @@ after it starts. */)
850 &team_id); 851 &team_id);
851 unblock_input (); 852 unblock_input ();
852 853
854 /* `be_roster_launch' can potentially take a while in IO, but
855 signals from async input will interrupt that operation. If the
856 user wanted to quit, act like it. */
857 maybe_quit ();
858
853 if (rc == B_OK) 859 if (rc == B_OK)
854 return SAFE_FREE_UNBIND_TO (depth, 860 return SAFE_FREE_UNBIND_TO (depth,
855 make_uint (team_id)); 861 make_uint (team_id));
862 else if (rc == B_ALREADY_RUNNING)
863 return Qalready_running;
856 864
857 return SAFE_FREE_UNBIND_TO (depth, Qnil); 865 return SAFE_FREE_UNBIND_TO (depth, Qnil);
858} 866}
@@ -913,6 +921,7 @@ used to retrieve the current position of the mouse. */);
913 DEFSYM (Qsize_t, "size_t"); 921 DEFSYM (Qsize_t, "size_t");
914 DEFSYM (Qssize_t, "ssize_t"); 922 DEFSYM (Qssize_t, "ssize_t");
915 DEFSYM (Qpoint, "point"); 923 DEFSYM (Qpoint, "point");
924 DEFSYM (Qalready_running, "already-running");
916 925
917 defsubr (&Shaiku_selection_data); 926 defsubr (&Shaiku_selection_data);
918 defsubr (&Shaiku_selection_put); 927 defsubr (&Shaiku_selection_put);