GNU bug report logs - #24193
25.1; `window-min-size' fails for horizontal width when margins >= body text

Previous Next

Package: emacs;

Reported by: Paul Rankin <hello <at> paulwrankin.com>

Date: Tue, 9 Aug 2016 09:15:01 UTC

Severity: normal

Found in version 25.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 24193 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Paul Rankin <hello <at> paulwrankin.com>, 24193 <at> debbugs.gnu.org
Subject: Re: bug#24193: 25.1; `window-min-size' fails for horizontal width
 when margins >= body text
Date: Tue, 09 Aug 2016 11:49:08 +0200
> 1. emacs -Q
> 2. in a frame 80 columns wide...
> 3. M-: (set-window-margins nil 20 20)
> 4. C-x 3
>      => "Window #<window 1 on *scratch*> too small for splitting (2)"
> 5. M-: (window-min-size nil t)
>      => 42
>
> Expected results:
>
> Window should split horizontally. Minimum window width should not be dictated by margin width.
>
> Actual results:
>
> Margin width dictates minimum window width and prevents window splitting.

Correct.  The Elisp manual states

 -- Function: window-min-size &optional window horizontal ignore
          pixelwise
     This function returns the minimum size of WINDOW.  WINDOW must be
     a valid window and defaults to the selected one.  The optional
     argument HORIZONTAL non-`nil' means to return the minimum number
     of columns of WINDOW; otherwise return the minimum number of
     WINDOW's lines.

     The return value makes sure that all components of WINDOW remain
     fully visible if WINDOW's size were actually set to it.  With
     HORIZONTAL `nil' it includes the mode and header line, the
     horizontal scroll bar and the bottom divider, if present.  With
     HORIZONTAL non-`nil' it includes the margins and fringes, the
     vertical scroll bar and the right divider, if present.

If you want to make a smaller window you have to explicitly specify its
size:

(defun split-window-right-ignore (&optional size)
  (interactive)
  (split-window-right (or size (/ (window-total-width) 2))))

(define-key ctl-x-map "3" 'split-window-right-ignore)

martin




This bug report was last modified 4 years and 317 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.