Some improvements and bug fixes for hooks:

- Prepare the state again before the "after" hooks are run, because the
  command may have killed or moved windows.

- Use the hooks list from the newly prepared target, not the old hooks
  list (only matters for new-session really).

- Correctly detect an invalid current state and ignore it in
  cmd_find_target ("killw; swapw").

- Change neww, new, killp, killw, splitw, swapp, swapw to update the
  current state (used if no explicit target is given) to something more
  useful after they have finished. For example, neww changes it to the
  newly created window.

Hooks are still relatively new and primitive so there are likely to be
more changes to come.

Parts based on bug reports from Uwe Werler and Iblis Lin.
10 files changed
tree: 8532ce29088d6b65b9615271dd6b5fdaa9984ca2
  1. Makefile
  2. alerts.c
  3. arguments.c
  4. attributes.c
  5. cfg.c
  6. client.c
  7. cmd-attach-session.c
  8. cmd-bind-key.c
  9. cmd-break-pane.c
  10. cmd-capture-pane.c
  11. cmd-choose-buffer.c
  12. cmd-choose-client.c
  13. cmd-choose-tree.c
  14. cmd-clear-history.c
  15. cmd-command-prompt.c
  16. cmd-confirm-before.c
  17. cmd-copy-mode.c
  18. cmd-detach-client.c
  19. cmd-display-message.c
  20. cmd-display-panes.c
  21. cmd-find-window.c
  22. cmd-find.c
  23. cmd-has-session.c
  24. cmd-if-shell.c
  25. cmd-join-pane.c
  26. cmd-kill-pane.c
  27. cmd-kill-server.c
  28. cmd-kill-session.c
  29. cmd-kill-window.c
  30. cmd-list-buffers.c
  31. cmd-list-clients.c
  32. cmd-list-keys.c
  33. cmd-list-panes.c
  34. cmd-list-sessions.c
  35. cmd-list-windows.c
  36. cmd-list.c
  37. cmd-load-buffer.c
  38. cmd-lock-server.c
  39. cmd-move-window.c
  40. cmd-new-session.c
  41. cmd-new-window.c
  42. cmd-paste-buffer.c
  43. cmd-pipe-pane.c
  44. cmd-queue.c
  45. cmd-refresh-client.c
  46. cmd-rename-session.c
  47. cmd-rename-window.c
  48. cmd-resize-pane.c
  49. cmd-respawn-pane.c
  50. cmd-respawn-window.c
  51. cmd-rotate-window.c
  52. cmd-run-shell.c
  53. cmd-save-buffer.c
  54. cmd-select-layout.c
  55. cmd-select-pane.c
  56. cmd-select-window.c
  57. cmd-send-keys.c
  58. cmd-send-prefix.c
  59. cmd-set-buffer.c
  60. cmd-set-environment.c
  61. cmd-set-hook.c
  62. cmd-set-option.c
  63. cmd-show-buffer.c
  64. cmd-show-environment.c
  65. cmd-show-messages.c
  66. cmd-show-options.c
  67. cmd-source-file.c
  68. cmd-split-window.c
  69. cmd-string.c
  70. cmd-swap-pane.c
  71. cmd-swap-window.c
  72. cmd-switch-client.c
  73. cmd-unbind-key.c
  74. cmd-wait-for.c
  75. cmd.c
  76. colour.c
  77. control-notify.c
  78. control.c
  79. environ.c
  80. format.c
  81. grid-view.c
  82. grid.c
  83. hooks.c
  84. input-keys.c
  85. input.c
  86. job.c
  87. key-bindings.c
  88. key-string.c
  89. layout-custom.c
  90. layout-set.c
  91. layout.c
  92. log.c
  93. mode-key.c
  94. names.c
  95. notify.c
  96. options-table.c
  97. options.c
  98. paste.c
  99. proc.c
  100. procname.c
  101. resize.c
  102. screen-redraw.c
  103. screen-write.c
  104. screen.c
  105. server-client.c
  106. server-fn.c
  107. server.c
  108. session.c
  109. signal.c
  110. status.c
  111. style.c
  112. tmux.1
  113. tmux.c
  114. tmux.h
  115. tty-acs.c
  116. tty-keys.c
  117. tty-term.c
  118. tty.c
  119. utf8.c
  120. window-choose.c
  121. window-clock.c
  122. window-copy.c
  123. window.c
  124. xmalloc.c
  125. xmalloc.h
  126. xterm-keys.c