Subject: Re: bug#68547: [PATCH] ; Fix 'mode-line-format-right-align' with ElDoc

From: Eshel Yaron <[email-masked]>
Date: Sat, 20 Jan 2024 16:33:36 +0100

Hi João,

João Távora <[email-masked]> writes:

>> I'm going to look at this function though, since I don't I love the
>> logic of destroying any old buffer's mode-line-format and not
>> restoring after the minibuffer is exited.

Agreed.

> While we're on the subject, can you give this patch a try Eshel?

Sure.  At first glance this looks good, but I ran into some issues.
First of all, looks like some lines in the patch got wrapped, so I
needed to tweak the patch manually a bit in order to apply it.

Then I tried the following (somewhat pathological) use case:

0. Setup: (keymap-global-set "C-x w a" #'windmove-swap-states-left)
1. Open two buffers in two windows side by side.
2. Say `M-: (car `, to show info in the mode line of the left window.
3. Without quitting the minibuffer, use `C-x o` to switch to the right
   window, followed by `C-x w a` to switch the buffers in the left and
   right windows.
4. Return to the minibuffer and type `nil) RET` or something like that
   to exit the minibuffer.
5. The `mode-line-format` of the left buffer is becomes nil, i.e. no mode line.

Shuffling `mode-line-format` around is really tricky :(