GNU bug report logs -
#19194
24.4.50; `window-body-width' is not dynamic relative to font size changes
Previous Next
Reported by: Joe Corneli <holtzermann17 <at> gmail.com>
Date: Wed, 26 Nov 2014 13:48:01 UTC
Severity: normal
Tags: notabug
Merged with 20022
Found in versions 24.4.50, 24.4.90
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Thu, Nov 27 2014, martin rudalics wrote:
> I'm not sure whether we want to define the size of a window in terms of
> the buffer displayed in that window. One consequence of such a change
> would be that the sum of the total height of two windows might no more
> equal the total height of their parent window.
I think you are totally right. To keep the buffer and window
distinction properly, my note should probably be read as a feature
request, not a bug report. The request is for a function such as
`buffer-body-width' that would return the width of the current displayed
buffer in em-length units.
> If you told me how you get the "adjusted font size", I could tell you
> how to scale the value returned by `window-body-width' accordingly.
Sounds promising! I just pressed C-x C-- which runs `text-scale-adjust'
to the effect: "Decrease the default face height by one step". The step
is `text-scale-mode-step', unchanged from its default value of 1.2. The
number of steps looks to be stored buffer-locally as
`text-scale-mode-amount'.
... So a candidate function would be:
(defun buffer-body-width (&optional buffer pixelwise)
(let ((width (window-body-width (get-buffer-window (or buffer
(current-buffer)))
pixelwise)))
(floor (cond
((eq text-scale-mode-amount 0)
width)
((> text-scale-mode-amount 0)
(/ width (* text-scale-mode-step text-scale-mode-amount)))
((< text-scale-mode-amount 0)
(* width (* -1 text-scale-mode-step text-scale-mode-amount)))))))
This bug report was last modified 3 years and 105 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.