]> git.eshelyaron.com Git - emacs.git/commitdiff
Miscellaneous corrections to src/minibuf.c for bug #48337
authorAlan Mackenzie <acm@muc.de>
Sat, 15 May 2021 11:49:49 +0000 (11:49 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 15 May 2021 11:49:49 +0000 (11:49 +0000)
* src/minibuf.c (read_minibuf): Call get_minibuffer before incrementing
minibuf_level, in case a hook function calls Factive_minibuffer_window.
(init_minibuf_once_for_pdumper): Create  *Minibuf-0* here (moved from
init_minibuf_once), and set its mode, so that clicking in the mini-window
immediately after start up works (thanks, Eli Z.).

src/minibuf.c

index 428998a639b35e28306a28f70acecbbc0909d729..b40d1fbafc879e9661434088e811f8f961bdd76b 100644 (file)
@@ -653,11 +653,12 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
       return unbind_to (count, val);
     }
 
-  minibuf_level++;         /* Before calling choose_minibuf_frame.  */
-  /* Ensure now that the latest minibuffer has been created, in case
-     anything happens which depends on MINNIBUF_LEVEL and
-     Vminibuffer_list being consistent with eachother.  */
-  minibuffer = get_minibuffer (minibuf_level);
+  /* Ensure now that the latest minibuffer has been created and pushed
+     onto Vminibuffer_list before incrementing minibuf_level, in case
+     a hook called during the minibuffer creation calls
+     Factive_minibuffer_window.  */
+  minibuffer = get_minibuffer (minibuf_level + 1);
+  minibuf_level++;             /* Before calling choose_minibuf_frame.  */
 
   /* Choose the minibuffer window and frame, and take action on them.  */
 
@@ -2278,8 +2279,6 @@ init_minibuf_once (void)
   staticpro (&Vminibuffer_list);
   staticpro (&Vcommand_loop_level_list);
   pdumper_do_now_and_after_load (init_minibuf_once_for_pdumper);
-  /* Ensure our inactive minibuffer exists.  */
-  get_minibuffer (0);
 }
 
 static void
@@ -2297,6 +2296,9 @@ init_minibuf_once_for_pdumper (void)
   minibuf_prompt = Qnil;
   minibuf_save_list = Qnil;
   last_minibuf_string = Qnil;
+  /* Ensure our inactive minibuffer exists.  */
+  Lisp_Object minibuf = get_minibuffer (0);
+  set_minibuffer_mode (minibuf, 0);
 }
 
 void