GNU bug report logs -
#9949
24.0.91; window-width function does not take text-scale-mode-amount into account
Previous Next
Reported by: Josh <josh <at> foxtail.org>
Date: Fri, 4 Nov 2011 02:44:02 UTC
Severity: normal
Merged with 13073
Found in version 24.0.91
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 9949 <at> debbugs.gnu.org (full text, mbox):
> From: Josh <josh <at> foxtail.org>
> Date: Thu, 3 Nov 2011 19:29:40 -0700
>
> The window-width function does not take text scale adjustments
> into account. This breaks code such as
> http://www.emacswiki.org/emacs/ErcFilling#toc2 which is meant to
> insert timestamps aligned to the right edge of the window.
>
> To reproduce starting from emacs -Q,
> 1) M-: (window-width) RET ; returns 80 here
> 2) C-x C-= ; window is now 70 characters wide
> 3) M-: (window-width) RET ; still returns 80
This is a problem with imprecise documentation and incorrect
expectations that are caused by that. window-width and window-height
report the window dimensions in frame's canonical units, i.e. for the
frame's default face. Changing the font size does not, therefore,
affect the values they return. AFAICS, this has been so since about
forever.
The code shown by the URL you cite should not use window-width. It
should instead use posn-at-point after moving to the line end (e.g.,
with `end-of-visual-line').
I've updated the doc strings and the ELisp manual with this caveat and
committed that as trunk revision 106283.
If you are satisfied with this resolution, I will close the bug
report. If not, then I think this should at best be tagged as
"wishlist", and it should request a different set of functions to
return the values you expected (because window-width and window-height
are used too widely to be able to sustain such a significant change in
functionality).
For someone to be able to implement these new functions, you (or
someone else) should come up with a specification of what they should
return in the presence of different faces in the window. E.g., should
the function that returns the line's width return values for a
specific line, rather than for a window as a whole? should it count
characters in that line or something else? etc., etc.
This bug report was last modified 12 years and 221 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.