unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 6253@debbugs.gnu.org
Subject: bug#6253: Please resize mini-buffer for queries even if
Date: Mon, 24 May 2010 00:24:39 +0200	[thread overview]
Message-ID: <AANLkTikqqbu74k90o5fs_PIMNFttUF3UKXoSoCxzVLYR@mail.gmail.com> (raw)
In-Reply-To: <jwvvdaeg16s.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

On Sun, May 23, 2010 at 4:10 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> Why not distinguish between those cases? Maybe a new value for
>> resize-mini-windows.
>
> Ah, you mean a setting that allows resizing minibuffers but not the
> echo area.  Yes, that seems reasonable (tho it may bump into some
> surprising cases where the user may think he's interacting with
> a minibuffer whereas she's really looking at the echo area).
>
> I'd first want to see a patch for it,


Thanks. I looked for read_filtered_event too in the sources.

I have attached a patch.

[-- Attachment #2: resize-mini-windows-1.diff --]
[-- Type: text/x-patch, Size: 6488 bytes --]



=== modified file 'src/fns.c'
--- trunk/src/fns.c	2010-04-25 22:16:58 +0000
+++ patched/src/fns.c	2010-05-23 22:13:34 +0000
@@ -2577,6 +2577,9 @@
   Lisp_Object args[2];
   struct gcpro gcpro1, gcpro2;
   int count = SPECPDL_INDEX ();
+  Lisp_Object old_Vresize_mini_windows = Vresize_mini_windows;
+
+  specbind (Qcursor_in_echo_area, Qt);
 
   specbind (Qcursor_in_echo_area, Qt);
 
@@ -2616,13 +2619,38 @@
 
       {
 	Lisp_Object pargs[3];
-
-	/* Colorize prompt according to `minibuffer-prompt' face.  */
+        Lisp_Object face;
+        Lisp_Object props;
+        Lisp_Object use_face;
+        Lisp_Object elt;
+
+        face = intern("face");
+        props = Fsymbol_value (intern ("minibuffer-prompt-properties"));
+        use_face = Qnil;
+
+        /* Colorize prompt according to `minibuffer-prompt-properties'.  */
+        use_face = intern("default");
+        while (1)
+          {
+            if (!CONSP (props) || EQ (XCAR (props), face))
+              break;
+
+            props = XCDR (props);
+          }
+        if (CONSP (props))
+          {
+            props = XCDR (props);
+            if (CONSP (props))
+              {
+                use_face = XCAR (props);
+              }
+          }
 	pargs[0] = build_string ("%s(y or n) ");
 	pargs[1] = intern ("face");
-	pargs[2] = intern ("minibuffer-prompt");
+        pargs[2] = use_face;
 	args[0] = Fpropertize (3, pargs);
 	args[1] = xprompt;
+        Vresize_mini_windows = Qt;
 	Fmessage (2, args);
       }
 
@@ -2637,6 +2665,8 @@
 
       temporarily_switch_to_single_kboard (SELECTED_FRAME ());
       obj = read_filtered_event (1, 0, 0, 0, Qnil);
+      message (0); /* Resize. */
+      Vresize_mini_windows = old_Vresize_mini_windows;
       cursor_in_echo_area = 0;
       /* If we need to quit, quit with cursor_in_echo_area = 0.  */
       QUIT;



=== modified file 'src/minibuf.c'
--- trunk/src/minibuf.c	2010-01-13 08:35:10 +0000
+++ patched/src/minibuf.c	2010-05-23 21:53:22 +0000
@@ -558,7 +558,7 @@
 
   /* If the minibuffer is on an iconified or invisible frame,
      make it visible now.  */
-  Fmake_frame_visible (mini_frame);
+  Fmake_frame_visible (mini_frame, Qnil);
 
   if (minibuffer_auto_raise)
     Fraise_frame (mini_frame);
@@ -576,13 +576,14 @@
 	     Fcons (minibuf_window,
 		    minibuf_save_list));
   minibuf_save_list
-    = Fcons (minibuf_prompt,
+    = Fcons (Vresize_mini_windows,
+         Fcons (minibuf_prompt,
 	     Fcons (make_number (minibuf_prompt_width),
 		    Fcons (Vhelp_form,
 			   Fcons (Vcurrent_prefix_arg,
 				  Fcons (Vminibuffer_history_position,
 					 Fcons (Vminibuffer_history_variable,
-						minibuf_save_list))))));
+						minibuf_save_list)))))));
 
   record_unwind_protect (read_minibuf_unwind, Qnil);
   minibuf_level++;
@@ -597,6 +598,7 @@
 
   minibuf_prompt_width = 0;
   minibuf_prompt = Fcopy_sequence (prompt);
+  Vresize_mini_windows = Qt;
   Vminibuffer_history_position = histpos;
   Vminibuffer_history_variable = histvar;
   Vhelp_form = Vminibuffer_help_form;
@@ -903,6 +905,7 @@
 {
   Lisp_Object old_deactivate_mark;
   Lisp_Object window;
+  Lisp_Object temp_Vresize_mini_windows;
 
   /* If this was a recursive minibuffer,
      tie the minibuffer window back to the outer level minibuffer buffer.  */
@@ -914,6 +917,14 @@
   Fset_buffer (XWINDOW (window)->buffer);
 
   /* Restore prompt, etc, from outer minibuffer level.  */
+  temp_Vresize_mini_windows = Fcar (minibuf_save_list);
+  minibuf_save_list = Fcdr (minibuf_save_list);
+  message (0); /* Resize. */
+  /* Check if changed in minibuffer, otherwise reset: */
+  if (Feq (Qt, Vresize_mini_windows))
+    {
+      Vresize_mini_windows = temp_Vresize_mini_windows;
+    }
   minibuf_prompt = Fcar (minibuf_save_list);
   minibuf_save_list = Fcdr (minibuf_save_list);
   minibuf_prompt_width = XFASTINT (Fcar (minibuf_save_list));



=== modified file 'src/lread.c'
--- trunk/src/lread.c	2010-04-20 01:50:52 +0000
+++ patched/src/lread.c	2010-05-23 20:13:31 +0000
@@ -800,11 +800,17 @@
      Lisp_Object prompt, inherit_input_method, seconds;
 {
   Lisp_Object val;
+  Lisp_Object old_Vresize_mini_windows = Vresize_mini_windows;
+  Vresize_mini_windows = Qt;
 
   if (! NILP (prompt))
     message_with_string ("%s", prompt, 0);
   val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method), seconds);
 
+  if (! NILP (prompt))
+      message (0); /* Resize. */
+  Vresize_mini_windows = old_Vresize_mini_windows;
+
   return (NILP (val) ? Qnil
 	  : make_number (char_resolve_modifier_mask (XINT (val))));
 }
@@ -822,9 +828,19 @@
      (prompt, inherit_input_method, seconds)
      Lisp_Object prompt, inherit_input_method, seconds;
 {
+  Lisp_Object val;
+  Lisp_Object old_Vresize_mini_windows = Vresize_mini_windows;
+  Vresize_mini_windows = Qt;
+
   if (! NILP (prompt))
     message_with_string ("%s", prompt, 0);
-  return read_filtered_event (0, 0, 0, ! NILP (inherit_input_method), seconds);
+  val = read_filtered_event (0, 0, 0, ! NILP (inherit_input_method), seconds);
+
+  if (! NILP (prompt))
+      message (0); /* Resize. */
+  Vresize_mini_windows = old_Vresize_mini_windows;
+
+  return val;
 }
 
 DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, 0,
@@ -845,12 +861,18 @@
      Lisp_Object prompt, inherit_input_method, seconds;
 {
   Lisp_Object val;
+  Lisp_Object old_Vresize_mini_windows = Vresize_mini_windows;
+  Vresize_mini_windows = Qt;
 
   if (! NILP (prompt))
     message_with_string ("%s", prompt, 0);
 
   val = read_filtered_event (1, 1, 0, ! NILP (inherit_input_method), seconds);
 
+  if (! NILP (prompt))
+      message (0); /* Resize. */
+  Vresize_mini_windows = old_Vresize_mini_windows;
+
   return (NILP (val) ? Qnil
 	  : make_number (char_resolve_modifier_mask (XINT (val))));
 }







=== modified file 'src/lisp.h'
--- trunk/src/lisp.h	2010-05-15 21:19:05 +0000
+++ patched/src/lisp.h	2010-05-23 15:47:47 +0000
@@ -2625,6 +2625,7 @@
 extern void safe_bcopy P_ ((const char *, char *, int));
 
 /* Defined in xdisp.c */
+extern Lisp_Object Vresize_mini_windows;
 extern Lisp_Object Qinhibit_point_motion_hooks;
 extern Lisp_Object Qinhibit_redisplay, Qdisplay;
 extern Lisp_Object Qinhibit_eval_during_redisplay;
















  reply	other threads:[~2010-05-23 22:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-23 11:46 bug#6253: Please resize mini-buffer for queries even if resize-mini-windows is nil Lennart Borgman
2010-05-23 13:43 ` Stefan Monnier
2010-05-23 13:49   ` Lennart Borgman
2010-05-23 14:10     ` bug#6253: Please resize mini-buffer for queries even if Stefan Monnier
2010-05-23 22:24       ` Lennart Borgman [this message]
2012-04-11 11:13         ` Lars Magne Ingebrigtsen
2012-04-11 12:56           ` Stefan Monnier
2019-06-27 17:12             ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikqqbu74k90o5fs_PIMNFttUF3UKXoSoCxzVLYR@mail.gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=6253@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).