I want to do some custom stuff before a window is deleted?
window-configuration-change-hook seems to be invoked after a window is deleted.
GNU Emacs 22.214.171.124 (i686-pc-linux-gnu, GTK+ Version 3.10.8) of 2016-04-25 shows that there is no such hook.
For an example the following advice would provide a hook for functions with a
WINDOW argument that is run before window
WINDOW is deleted.
(defvar window-before-delete-functions nil "Functions to be run with argument WINDOW before \(delete-window WINDOW).") (defun delete-window-ad (window) "Add `window-before-delete-functions' as before-advice of \(delete-window WINDOW)." (run-hook-with-args 'window-before-delete-functions (or window (selected-window)))) (advice-add #'delete-window :before #'delete-window-ad)
Just remove the hook functions in
window-before-delete-functions if something goes wrong with them.