From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Corneli Newsgroups: gmane.emacs.bugs Subject: bug#19194: 24.4.50; `window-body-width' is not dynamic relative to font size changes Date: Thu, 27 Nov 2014 20:23:32 +0000 Message-ID: <87a93cqtob.fsf@gmail.com> References: <87h9xm6plp.fsf@gmail.com> <5476F298.5000205@gmx.at> <87ppc8rk08.fsf@gmail.com> <54776EED.9090303@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1417119871 31540 80.91.229.3 (27 Nov 2014 20:24:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Nov 2014 20:24:31 +0000 (UTC) Cc: 19194@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 27 21:24:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xu5bx-0005Yn-HB for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Nov 2014 21:24:21 +0100 Original-Received: from localhost ([::1]:41426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xu5bw-00015c-QA for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Nov 2014 15:24:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xu5bm-00015T-9d for bug-gnu-emacs@gnu.org; Thu, 27 Nov 2014 15:24:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xu5be-0004L3-OU for bug-gnu-emacs@gnu.org; Thu, 27 Nov 2014 15:24:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xu5be-0004Kz-Ld for bug-gnu-emacs@gnu.org; Thu, 27 Nov 2014 15:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xu5be-0004d0-5S for bug-gnu-emacs@gnu.org; Thu, 27 Nov 2014 15:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Joe Corneli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Nov 2014 20:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19194 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19194-submit@debbugs.gnu.org id=B19194.141711981717757 (code B ref 19194); Thu, 27 Nov 2014 20:24:02 +0000 Original-Received: (at 19194) by debbugs.gnu.org; 27 Nov 2014 20:23:37 +0000 Original-Received: from localhost ([127.0.0.1]:47936 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xu5bE-0004cK-Uh for submit@debbugs.gnu.org; Thu, 27 Nov 2014 15:23:37 -0500 Original-Received: from mail-wg0-f43.google.com ([74.125.82.43]:64238) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xu5bC-0004cA-OF for 19194@debbugs.gnu.org; Thu, 27 Nov 2014 15:23:35 -0500 Original-Received: by mail-wg0-f43.google.com with SMTP id l18so7251390wgh.30 for <19194@debbugs.gnu.org>; Thu, 27 Nov 2014 12:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type:content-transfer-encoding; bh=mrIAqwXNxjq3ojOL/sDiAO2CXeCCxspKtwcM9w0P8BI=; b=FPLgqPUwcTodfpHmfWbsTP+1jWkhPRrTd/E4DzIT9PErpyY306PBJAycfWe1uNa/cr qhimXjWX53UBwK5lCiViREAltyRfeKGwE6stWP4NQCGn7VmFiIz0dhkoEGqLkgfG9kDG 7bICxsSRONl3W5QcvW+DxRH6ippHSS/y2Kx9uHisNo4LecwLpZt+inKBxVnBCYEGYUgq 2q99zoriL4aKrXTDwSutNa6PHPbmv9bIP+nXb9fWzPNoUm1Y8FoWPkrNCiEqfGbA7MJf HvoltlZT//nJ42q287XyTVgRh5vu19xq/3YydvXZU4EC2F8E2Sk43UAQPUid2lv51Rst 2JXw== X-Received: by 10.180.24.193 with SMTP id w1mr55450117wif.34.1417119814151; Thu, 27 Nov 2014 12:23:34 -0800 (PST) Original-Received: from Teacup (cpc2-flit3-2-0-cust79.9-1.cable.virginm.net. [213.105.32.80]) by mx.google.com with ESMTPSA id qg11sm6199496wic.17.2014.11.27.12.23.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Nov 2014 12:23:33 -0800 (PST) In-reply-to: <54776EED.9090303@gmx.at> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96684 Archived-At: On Thu, Nov 27 2014, martin rudalics wrote: > > 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. > > What is the width of a buffer? What are em-lenght units? I mean, the distance (in useful units!) from the left side of the buffer, as displayed within a given window, to the right side of that window. If the buffer is displayed using *a fixed width font*, then one useful unit is *columns*, i.e. the number of columns that can be displayed before line wrap or continuation kicks in. However, if the buffer is displayed using a variable-width font, then "columns" is *not* necessarily a meaningful unit -- as has been pointed out in the earlier discussion. In this case, see below for "ems." To be clear, the width of the *window* calculated in non-buffer-specific units is not generally "useful" for the purpose of measuring the number of characters that can be fit, horizontally, into the buffer. Nevertheless, if the window is displayed using *the default face* at the default scale (and if the default font happens to be fixed width!) then `window-body-width' does indeed return the number of columns. >From Wikipedia: «An em is a unit in the field of typography, equal to the currently specified point size. For example, one em in a 16-point typeface is 16 points. Therefore, this unit is the same for all typefaces at a given point size. [...] The name "em" was originally a reference to the width of the the capital "M" in the typeface and size being used, which was often the same as the point size.» > (2) `text-scale-mode-amount' is buffer-local. So we have to choose the > right buffer before evaluating it. I agree, this is indeed an important. > (3) `text-scale-mode-amount' constitutes a request to the display engine > to scale a face height. What shall we do when our target machine > can't display the character with the requested height and uses, for > example, the nearest available height instead? Presumably the function should fall back to the height (and corresponding scale factor) that is actually used. This is an edge case that I hadn't considered!