[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55169: Can't combine window-min-height with window-height
From: |
Juri Linkov |
Subject: |
bug#55169: Can't combine window-min-height with window-height |
Date: |
Wed, 18 May 2022 21:20:05 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
> (defun shrink-window-if-larger-than-buffer (&optional window min-height)
> "Shrink height of WINDOW if its buffer doesn't need so many lines.
> More precisely, shrink WINDOW vertically to be as small as
> possible, while still showing the full contents of its buffer.
> WINDOW must be a live window and defaults to the selected one.
>
> The optional argument MIN-HEIGHT specifies the minimum number of
> lines to which WINDOW may be shrunk and defaults to
> `window-min-height'.
>
> Do nothing if the buffer contains more lines than the present
> height of WINDOW, some of WINDOW's contents are scrolled out of
> view, shrinking WINDOW would also shrink another window, or
> WINDOW is the root window of its frame.
>
> Return non-nil if WINDOW was shrunk, nil otherwise."
> (interactive)
> (setq window (window-normalize-window window t))
> ;; Make sure that WINDOW is vertically combined and `point-min' is
> ;; visible (for whatever reason that's needed). The remaining issues
> ;; should be taken care of by `fit-window-to-buffer'.
> (when (and (window-combined-p window)
> (pos-visible-in-window-p (point-min) window))
> (let ((old-height (window-pixel-height window)))
> (fit-window-to-buffer
> window (window-total-height window) nil min-height)
Thanks, this works fine, after removing nil above.
- bug#55169: Can't combine window-min-height with window-height, (continued)
- bug#55169: Can't combine window-min-height with window-height, Juri Linkov, 2022/05/09
- bug#55169: Can't combine window-min-height with window-height, martin rudalics, 2022/05/10
- bug#55169: Can't combine window-min-height with window-height, Juri Linkov, 2022/05/11
- bug#55169: Can't combine window-min-height with window-height, martin rudalics, 2022/05/11
- bug#55169: Can't combine window-min-height with window-height, Juri Linkov, 2022/05/12
- bug#55169: Can't combine window-min-height with window-height, martin rudalics, 2022/05/13
- bug#55169: Can't combine window-min-height with window-height, Juri Linkov, 2022/05/13
- bug#55169: Can't combine window-min-height with window-height, martin rudalics, 2022/05/14
- bug#55169: Can't combine window-min-height with window-height, Richard Stallman, 2022/05/11
- bug#55169: Can't combine window-min-height with window-height, Juri Linkov, 2022/05/12
- bug#55169: Can't combine window-min-height with window-height,
Juri Linkov <=
- bug#55169: Can't combine window-min-height with window-height, martin rudalics, 2022/05/19
- bug#55169: Can't combine window-min-height with window-height, Juri Linkov, 2022/05/19