Subject: bug#12081: 24.1; buffer-predicate often not called

From: martin rudalics <[email-masked]>
Date: Sun, 29 Jul 2012 19:08:10 +0200

>>> 1. Evaluate:
 >>>
 >>> (set-frame-parameter
 >>>    (selected-frame)
 >>>    'buffer-predicate (lambda (b) (message "buffer predicate: %s" b)))
 >>> 2. `C-x C-f /tmp/xx RET'
 >>>
 >>> 3. `C-x C-f /tmp/yy RET'
 >>>
 >>> 4. `C-x k RET'
 >>>
 >>> 5. `M-: (message "======")'
 >>>
 >>> 6. `C-x b *Messages* RET'
 >>>
 >>> This shows that the buffer-predicate never called when deciding what
 >>> buffer to replace yy with.
 >> Not so here: *Messages* contains the three lines fragment below
 >>
 >> =====
 >> "====="
 >> buffer predicate: *scratch*
 >
 > Actually that shows exactly what I claimed.  There's a reason I added
 > step 5.  The buffer predicate is not called until we try to switch to
 > the *Messages* buffer.  IMO it should be called when yy is killed.

I see.  But `kill-buffer' calls `replace-buffer-in-windows' which
doesn't call `other-buffer'.  Only if the buffer to be killed is still
current after that, `kill-buffer' calls `other-buffer'.  In the scenario
above it is not called.

Why is showing the buffer visiting /tmp/xx bad in your scenario?  Can
you give a scenario where the present behavior really hurts you?  In
that case we can try to ignore such a buffer in `switch-to-prev-buffer'.

martin