unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Josh <josh@foxtail.org>
Cc: 9949@debbugs.gnu.org
Subject: bug#9949: 24.0.91; window-width function does not take text-scale-mode-amount into	account
Date: Fri, 04 Nov 2011 12:25:57 +0200	[thread overview]
Message-ID: <83r51okwui.fsf@gnu.org> (raw)
In-Reply-To: <CANdFEAEVX2ToewFR9FXY+cy=QbqSs8+5G7XoWSzR_2T8X9wrFQ@mail.gmail.com>

> From: Josh <josh@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.





  reply	other threads:[~2011-11-04 10:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-04  2:29 bug#9949: 24.0.91; window-width function does not take text-scale-mode-amount into account Josh
2011-11-04 10:25 ` Eli Zaretskii [this message]
     [not found]   ` <CANdFEAF10Lkp3VXe-aLa2nQi6BJWzDQiVdY9m3-uYAQxxWBqMA@mail.gmail.com>
2011-11-04 16:02     ` Eli Zaretskii
2011-11-04 18:30       ` Josh
2011-11-04 19:58         ` martin rudalics
2011-11-04 20:12         ` Eli Zaretskii
2011-11-04 13:56 ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83r51okwui.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=9949@debbugs.gnu.org \
    --cc=josh@foxtail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).