Subject: bug#48409: Text runs away before user can copy it

From: Alan Mackenzie <[email-masked]>
Date: Fri, 14 May 2021 20:53:38 +0000

Hello, Eli.

On Fri, May 14, 2021 at 23:13:50 +0300, Eli Zaretskii wrote:
> > Date: Fri, 14 May 2021 22:45:43 +0300
> > From: Eli Zaretskii <[email-masked]>
> > Cc: [email-masked]

> > > (defvar minibuffer-inactive-mode-map
> > >   (let ((map (make-keymap)))
> > >     ...
> > >     (define-key map [mouse-1] 'view-echo-area-messages)

> > > But now clicking mouse-1 reports an error.

> > It reports an error because it doesn't invoke view-echo-area-messages.

> > Alan, this minibuffer-inactive-mode-map thing doesn't seem to work
> > with mouse clocks, please take a look.

> Alan, is the below the right fix?  The problem is that no one is
> setting up the minibuffer in inactive mode until after the first time
> the minibuffer is activated.

> diff --git a/src/minibuf.c b/src/minibuf.c
> index 428998a..9ec93a0 100644
> --- a/src/minibuf.c
> +++ b/src/minibuf.c
> @@ -2297,6 +2297,8 @@ init_minibuf_once_for_pdumper (void)
>    minibuf_prompt = Qnil;
>    minibuf_save_list = Qnil;
>    last_minibuf_string = Qnil;
> +  Lisp_Object minibuf = get_minibuffer (0);
> +  set_minibuffer_mode (minibuf, 0);
>  }
> 
>  void

I'm not entirely sure.  I actually added a "get_minibuffer (0);" to
init_minibuf_once in my commit earlier on today, so perhaps the
"set_minibuffer_mode (minibuf, 0);" really belongs in that function.

I'm not quite sure in my own mind what should go into init_minibuf_once
and what into init_minibuf_once_for_pdumper.  I've taken as the
criterion what the comment there says:

  /* We run this function on first initialization and whenever we
     restore from a dump file.  pdumper doesn't try to preserve
     frames, windows, and so on, so reset everything related here.  */

, and thus put the creation of  *Minibuf-0* into init_minibuf_once.

It would be good to have a relatively simple fix for something in
minibuf.c, for once.  ;-)

-- 
Alan Mackenzie (Nuremberg, Germany).