Subject: Re: bug#48337: Fwd: 28.0.50; Emacs crashing randomly (possibly minibuffer activity related)

From: Alan Mackenzie <[email-masked]>
Date: Thu, 13 May 2021 09:52:19 +0000

Hello, Martin.

On Thu, May 13, 2021 at 09:54:52 +0200, martin rudalics wrote:
>  > The deeper cause of the bug is that calling buffer-list-update-hook
>  > simply doesn't belong in record-window-buffer.  That hook should be
>  > called when the buffer list changes, not when a window's current buffer
>  > gets "recorded".

>  > So, as the main fix, I propose moving the call of buffer-list-update-hook
>  > to (some of) the places where record-window-buffer gets called, those
>  > places where the buffer list changes.  There are exactly two such places,
>  > both in window.c.  This will prevent the chain of events in read_minibuf
>  > outlined above.

> Alan, please take one step back and reconsider.  IIUC you added the
> `record-window-buffer' call to read_minibuf, added the DO-MINIBUF
> argument to `record-window-buffer' and now decide that
> `buffer-list-update-hook' doesn't belong into `record-window-buffer'.

> Aren't you putting the cart before the horse?  That decision might be
> correct but still constitutes a change that affects all applications
> running `buffer-list-update-hook'.

Maybe you're right.  I've never really liked those changes to
record-window-buffer, they're a bit scruffy.  The requirement is simply
to push a minibuffer onto w->prev_buffers, where w is the mini-window of
a frame.

Maybe I should instead undo those changes to r-w-b, and write a separate
function for pushing the minibuffer onto w->prev_buffers.  This would
surely be cleaner.  Whether that function should be in C or in Lisp
(like record-window-buffer) would need to be decided.  Maybe r-w-b could
use that new function to avoid duplicating code.

> martin

-- 
Alan Mackenzie (Nuremberg, Germany).