GNU bug report logs - #19194
24.4.50; `window-body-width' is not dynamic relative to font size changes

Previous Next

Package: emacs;

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


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joe Corneli <holtzermann17 <at> gmail.com>
Cc: 19194 <at> debbugs.gnu.org
Subject: Re: bug#19194: 24.4.50;
 `window-body-width' is not dynamic relative to font size changes
Date: Wed, 26 Nov 2014 18:04:38 +0200
> From: Joe Corneli <holtzermann17 <at> gmail.com>
> Date: Wed, 26 Nov 2014 13:47:14 +0000
> 
> Adjusting the font size, I would expect that the window's "body width"
> would change -- more characters can be fit into the same amount of
> screen space.  Current behaviour does not match this expectation.
> 
> M-: (window-body-width) RET  [Note result.]
> C-x C--
> M-: (window-body-width) RET  [Result is the same.]
> 
> The function is described:
> 
> "This function returns the width, in columns, of the body of window
> window."

That's not what it says in Emacs 24.4.  It says this:

  If PIXELWISE is nil, return the largest integer smaller than WINDOW's
  pixel width divided by the character width of WINDOW's frame.

IOW, the function is explicitly documented to measure columns in
canonical character units.  It functions as designed.

> If for some reason the "nominal" number of columns needs to calculated
> with reference to the default font, then there should be another
> function to return the "actual" number of columns.
> 
> ( I note one practical implication of the underlying issue here:
> https://github.com/kiwanami/emacs-calfw/issues/45 )

I've read that, and since I don't know what Calfw is or what it does,
it is hard for me to interpret your use case.  If you explain it in
small words, I'm sure a solution will be found, as Emacs has more than
enough functions to give you the width in any units you want, provided
that they are uniform (i.e., don't expect that to work when teh window
uses variable size fonts).

One simple technique is to measure everything in pixels, but I don't
know at this point whether this will solve your use case.




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.