summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authornicm <nicm>2016-10-13 22:48:51 +0000
committernicm <nicm>2016-10-13 22:48:51 +0000
commit4289a1ebfa7479413ec5ac543b88c4ea039d00a0 (patch)
treed17862b06b8822aa1b8ab91d83e51a47e25e60e3 /cmd-new-session.c
parent7a1a01feeff7b2ab17e2caef2d6b2180a8c1e70e (diff)
Trying to do hooks generically is way too complicated and unreliable and
confusing, particularly trying to automatically figure out what target hooks should be using. So simplify it: - drop before hooks entirely, they don't seem to be very useful; - commands with special requirements now fire their own after hook (for example, if they change session or window, or if they have -t and -s and need to choose which one the hook uses as current target); - commands with no special requirements can have the CMD_AFTERHOOK flag added and they will use the -t state. At the moment new-session, new-window, split-window fire their own hook, and display-message uses the flag. The remaining commands still need to be looked at.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 5292efcc..5924b793 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -80,6 +80,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
u_int sx, sy;
struct format_tree *ft;
struct environ_entry *envent;
+ struct cmd_find_state fs;
if (self->entry == &cmd_has_session_entry) {
/*
@@ -310,13 +311,15 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
format_free(ft);
}
- cmd_find_from_session(&cmdq->current, s);
-
if (!detached)
cmdq->client_exit = 0;
if (to_free != NULL)
free((void *)to_free);
+
+ cmd_find_from_session(&fs, s);
+ if (hooks_wait(s->hooks, cmdq, &fs, "after-new-session") == 0)
+ return (CMD_RETURN_WAIT);
return (CMD_RETURN_NORMAL);
error: