I was thinking the similar but cannot find a way to construct
the
window-buffer associations. Do you mind giving me some hint :)
The code below should do that.
(defun update-window-buffer-list ()
(let ((old (frame-parameter nil 'window-buffer-list))
new this)
(walk-window-tree
(lambda (window)
(let ((old-buffer (cdr (assq window old)))
(new-buffer (window-buffer window)))
(unless (eq old-buffer new-buffer)
;; The buffer of a previously existing window has changed
or
;; a new window has been added to this frame.
(ding))
(setq new (cons (cons window new-buffer) new)))))
(set-frame-parameter nil 'window-buffer-list new)))
(add-hook 'window-configuration-change-hook
'update-window-buffer-list)
You can write a more destructive version using ‘setcdr’.
martin