all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matt Beshara <m@mfa.pw>
To: martin rudalics <rudalics@gmx.at>, 54380@debbugs.gnu.org
Subject: bug#54380: 29.0.50; Unexpected nil value of 'rest' in 'balance-windows-2'
Date: Tue, 15 Mar 2022 21:20:13 +1100	[thread overview]
Message-ID: <644A67C2-B669-4000-A2CF-D9101F4868F6@mfa.pw> (raw)
In-Reply-To: <4a197cfd-2598-95f2-328a-da987b8e722b@gmx.at>

On 14 March 2022 8:30:40 pm AEDT, martin rudalics <rudalics@gmx.at> wrote:
>If the code had used a term like say 'number-of-resizable-children' we
>might have been able to avoid this bug in the first place.  Too bad ...
>
> > Attempting to use ‘balance-windows’ in a frame displaying many
> > windows, two of which are displaying buffers which both have the
> > buffer-local variable ‘window-size-fixed’ set to t, fails with the
> > error “Wrong type argument: number-or-marker-p, nil”.  This error is
> > produced by line 5765 of window.el, “(while (and sub (> rest 0))”.  It
> > appears that the code in this function always expects ‘rest’ to have a
> > non-nil value, but in this case ‘rest’ is nil. Modifying line 5765 to
> > read “(while (and sub rest (> rest 0))” so that it checks ‘rest’ is
> > non-nil before attemping to call ‘>’ seems to fix it.  I haven’t
> > attached a patch as a patch for a one-line diff seems excessive, but
> > if it would be useful, I can provide one.
>
>Thanks for the report.  The bug is a consequence of the following
>sequence of steps in 'balance-windows-2':
>
>- If an internal window has only fixed-size children, we eventually set
>   'number-of-children' to zero here
>
>	    (setq number-of-children (1- number-of-children))
>
>- We set 'rest' only if 'number-of-children' is greater zero here
>
>     (when (> number-of-children 0)
>       (setq rest (% total-sum number-of-children))
>
>- We ask for the value of 'rest' when a window has at least one child as
>
>   (let* (...
>          (first (window-child window))
>
>     (setq sub first)
>     (while (and sub (> rest 0))
>
>I checked in a fix, please try with latest master.
>
>Thanks again, martin

The fix works very well, thank you.





  reply	other threads:[~2022-03-15 10:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14  2:43 bug#54380: 29.0.50; Unexpected nil value of 'rest' in 'balance-windows-2' Matt Beshara
2022-03-14  9:30 ` martin rudalics
2022-03-15 10:20   ` Matt Beshara [this message]
2022-03-16  8:17     ` martin rudalics

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

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

  git send-email \
    --in-reply-to=644A67C2-B669-4000-A2CF-D9101F4868F6@mfa.pw \
    --to=m@mfa.pw \
    --cc=54380@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.