Subject: bug#11276: minibuffers windows can no longer explictly be resized

From: martin rudalics <[email-masked]>
Date: Thu, 19 Apr 2012 19:18:21 +0200

>> First bug.  I forgot that one can invoke `enlarge-window' and
 >> `shrink-window' in the minibuffer window.  I'm not sure though whether these
 >> should have any effect when `resize-mini-windows' is non-nil.
 >
 > For compatibility with previous versions of Emacs, I think it
 > shouldn't, at least not on the emacs-24 branch.

Sorry, my formulation was probably unclear.  In Emas 23 you can often
resize the active minibuffer window manually (via `enlarge-window' or
`adjust-window-trailing-edge') regardless of the setting of
`resize-mini-windows'.  So should we keep that behavior or allow manual
resizing only when `resize-mini-windows' is nil?

 > resize-mini-windows is a misnomer: it actually means "mini-window size
 > is controlled by display engine".  That's why window-sizing commands
 > in previous versions never paid heed to it, only redisplay did.  And
 > that's why, quite counter-intuitively, setting it to _nil_ allows the
 > user to resize the mini-window.

The passive mini-window IIUC.

 > We could make the implementation more in line with the name in future
 > versions, if we want, of course.

That's another issue.

Please try the new patch I attached.  It should mimic the behavior of
Emacs 23 as close as possible.

martin
=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2012-01-19 07:21:25 +0000
+++ lisp/mouse.el	2012-04-19 17:09:19 +0000
@@ -406,9 +406,11 @@
 		       (mouse-on-link-p start)))
 	 (enlarge-minibuffer
 	  (and (eq line 'mode)
-	       (not resize-mini-windows)
-	       (eq (window-frame minibuffer-window) frame)
-	       (not (one-window-p t frame))
+	       ;; Enlarge the minibuffer window iff it's either selected
+	       ;; or `resize-mini-windows' is nil.
+	       (or (not resize-mini-windows)
+		   (eq minibuffer-window (selected-window)))
+	       (not (one-window-p))
 	       (= (nth 1 (window-edges minibuffer-window))
 		  (nth 3 (window-edges window)))))
 	 (which-side

=== modified file 'lisp/window.el'
--- lisp/window.el	2012-04-11 02:36:04 +0000
+++ lisp/window.el	2012-04-19 17:09:12 +0000
@@ -1991,17 +1991,21 @@
 the left.  If the edge can't be moved by DELTA lines or columns,
 move it as far as possible in the desired direction."
   (setq window (window-normalize-window window))
-  (let ((frame (window-frame window))
-	(right window)
-	left this-delta min-delta max-delta)
+  (let* ((frame (window-frame window))
+	 (minibuffer-window (minibuffer-window frame))
+	 (right window)
+	 left this-delta min-delta max-delta)
     ;; Find the edge we want to move.
     (while (and (or (not (window-combined-p right horizontal))
 		    (not (window-right right)))
 		(setq right (window-parent right))))
     (cond
-     ((and (not right) (not horizontal) (not resize-mini-windows)
-	   (eq (window-frame (minibuffer-window frame)) frame))
-      (window--resize-mini-window (minibuffer-window frame) (- delta)))
+     ((and (not right) (not horizontal)
+	   ;; Resize the minibuffer window iff it's either active or
+	   ;; `resize-mini-windows' is nil. 
+	   (or (not resize-mini-windows)
+	       (eq minibuffer-window (selected-window))))
+      (window--resize-mini-window minibuffer-window (- delta)))
      ((or (not (setq left right)) (not (setq right (window-right right))))
       (if horizontal
 	  (error "No window on the right of this one")
@@ -2102,6 +2106,8 @@
    ((zerop delta))
    ((window-size-fixed-p nil horizontal)
     (error "Selected window has fixed size"))
+   ((and (window-minibuffer-p) (not horizontal))
+    (window--resize-mini-window (selected-window) delta))
    ((window--resizable-p nil delta horizontal)
     (window-resize nil delta horizontal))
    (t
@@ -2124,6 +2130,8 @@
    ((zerop delta))
    ((window-size-fixed-p nil horizontal)
     (error "Selected window has fixed size"))
+   ((and (window-minibuffer-p) (not horizontal))
+    (window--resize-mini-window (selected-window) (- delta)))
    ((window--resizable-p nil (- delta) horizontal)
     (window-resize nil (- delta) horizontal))
    (t