🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87461

shrink-window-if-larger-than-buffer fails from minibuffer-only frame

#87461
From: Ray Nickson
Date: Fri, 16 Sep 1994 07:35
47 lines
2751 bytes
In GNU Emacs 19.27.1 (sparc-sun-solaris2.3) of Thu Sep 15 1994 on everest

I have (minibuffer . nil) in my default- and initial-frame-alist, and
(minibuffer . only) in my minibuffer-frame-alist.

I use shrink-window-if-larger-than-buffer inside my
temp-buffer-show-function, as shown at the end of this message.

Upon switching to 19.27 (from 19.22), I find that I get an error:
Signalling: (wrong-type-argument window-live-p only)
  window-edges(only)
  shrink-window-if-larger-than-buffer(#<window 8 on *Backtrace*>)
  (let ((win ...)) (shrink-window-if-larger-than-buffer win))
  (if (equal (window-buffer ...) buf) buf (delete-windows-on buf t) (let (...) (shrink-window-if-larger-than-buffer win)))
  temp-buffer-show-small(#<buffer *Completions*>)
  minibuffer-complete()
  call-interactively(minibuffer-complete)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

In window.el, shrink-window-if-larger-than-buffer is setting `mini' by
looking up the current frame parameters, then assuming the result is a
window.  In this case, that clearly isn't desirable.  I don't properly
understand what this code is doing, but I suspect the root of the
confusion is that frame-parameters is being done on the selected
frame, when it should in fact be done on the frame of the window to be
shrunk.

Detailed recipe to reproduce the bug:
Create a .emacs containing just the following:

    (setq default-frame-alist  '((minibuffer . nil))
          minibuffer-frame-alist '((minibuffer . only) (height . 1))
          initial-frame-alist default-frame-alist)

    (defun temp-buffer-show-small (buf)
      (if (equal (window-buffer (selected-window)) buf)
          buf
        (delete-windows-on buf t)
        (let ((win (display-buffer buf)))
          (shrink-window-if-larger-than-buffer win))))

    (setq temp-buffer-show-function 'temp-buffer-show-small)

Start emacs (without -q), then type M-x s e t - TAB

Ray
Technical Details
Message-ID: <9409160731.AA10423@uqcspe.cs.uq.oz.au>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cs.uq.oz.au!nickson

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,360cc5cb23f4a30e,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-09-16 21:48:37 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cs.uq.oz.au!nickson
From: nickson@cs.uq.oz.au (Ray Nickson)
Newsgroups: gnu.emacs.bug
Subject: shrink-window-if-larger-than-buffer fails from minibuffer-only frame
Date: 16 Sep 1994 03:35:30 -0400
Organization: GNUs Not Usenet
Lines: 47
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9409160731.AA10423@uqcspe.cs.uq.oz.au>