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 10:54:47 +0000 Message-ID: <87ppc8rk08.fsf@gmail.com> References: <87h9xm6plp.fsf@gmail.com> <5476F298.5000205@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1417085728 10895 80.91.229.3 (27 Nov 2014 10:55:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Nov 2014 10:55:28 +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 11:55:21 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 1XtwjI-0005kY-Oi for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Nov 2014 11:55:20 +0100 Original-Received: from localhost ([::1]:38768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtwjI-0000ov-29 for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Nov 2014 05:55:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtwj8-0000oi-8i for bug-gnu-emacs@gnu.org; Thu, 27 Nov 2014 05:55:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xtwj0-0004pS-OX for bug-gnu-emacs@gnu.org; Thu, 27 Nov 2014 05:55:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtwj0-0004oW-Ko for bug-gnu-emacs@gnu.org; Thu, 27 Nov 2014 05:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xtwj0-0002XK-8R for bug-gnu-emacs@gnu.org; Thu, 27 Nov 2014 05:55: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 10:55: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.14170856929731 (code B ref 19194); Thu, 27 Nov 2014 10:55:02 +0000 Original-Received: (at 19194) by debbugs.gnu.org; 27 Nov 2014 10:54:52 +0000 Original-Received: from localhost ([127.0.0.1]:47034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xtwip-0002Wt-QC for submit@debbugs.gnu.org; Thu, 27 Nov 2014 05:54:52 -0500 Original-Received: from mail-wi0-f177.google.com ([209.85.212.177]:44452) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xtwin-0002Wl-Kd for 19194@debbugs.gnu.org; Thu, 27 Nov 2014 05:54:50 -0500 Original-Received: by mail-wi0-f177.google.com with SMTP id l15so7897861wiw.10 for <19194@debbugs.gnu.org>; Thu, 27 Nov 2014 02:54:49 -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; bh=e10EDwL7eTpVjfrdxwRRS9sqsCN1Me/zpmnVF0sxpAI=; b=0+WxMFFxHGHDfIPeE1uCBViQnYA4WPPxr3eG9/BskDFejMoTnNi8IqSgVVs2ZjWaf6 x1qXp/15fqPCfquHeivrnR6hATL+p2AIEAHWP6uCYSaooQTxE+uQYzBI9LThBeWFh1aI D7Ic0iC9vtZs9i7JERWxC0vUf1GQV6tYCIBKF/wn+cPQYn9HMy6rTyGiov47Ywy6QQ5C U41JsYq6piHrl7q6frQfT1NcyZDQ0rnM3P1PWz//6An71xy6tKNlXOngjD67EAaip/Pf yCxTuYuoPcuOqSxsV5imkhNaaE4WTNd6eYTJ24JreaKRdr1Rvvc7suai4NTKGA0yEgsi ZhpA== X-Received: by 10.194.133.66 with SMTP id pa2mr14249678wjb.134.1417085688997; Thu, 27 Nov 2014 02:54:48 -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 bf6sm10179357wjb.13.2014.11.27.02.54.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Nov 2014 02:54:48 -0800 (PST) In-reply-to: <5476F298.5000205@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:96663 Archived-At: 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)))))))