>> Please note that in the code posted 3 days ago I used the hook that you >> proposed recently window-state-change-functions, so this code is not yet >> functional :) > > Ahh.. That hook has not been written yet and I'm not sure whether I'll > be able to ever do that. In either case: The window state will not > change when a window gets just reused by 'display-buffer' and no > selection takes place. So can't you simply use 'post-command-hook' > for your purpose? The implementation of window-state-change-functions posted to bug#32672 uses post-command-hook. It makes possible display-buffer-directionally, e.g. S-M-up ffap RET will open a file link in the upper window, etc.