From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#64986: 30.0.50; window-text-pixel-size sometimes returns 0 width when called from temporary buffer Date: Tue, 01 Aug 2023 13:13:08 +0000 Message-ID: <87edkmq523.fsf@localhost> References: <87o7jrgq5n.fsf@localhost> <83pm470xuv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20616"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64986@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 01 15:14:25 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qQpCj-0005A9-15 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Aug 2023 15:14:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQpCN-0006O2-PM; Tue, 01 Aug 2023 09:14:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQpCM-0006MB-Fd for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2023 09:14:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQpCM-0002vY-8F for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2023 09:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qQpCL-0004Ai-Kh for bug-gnu-emacs@gnu.org; Tue, 01 Aug 2023 09:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Aug 2023 13:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64986 X-GNU-PR-Package: emacs Original-Received: via spool by 64986-submit@debbugs.gnu.org id=B64986.169089558315961 (code B ref 64986); Tue, 01 Aug 2023 13:14:01 +0000 Original-Received: (at 64986) by debbugs.gnu.org; 1 Aug 2023 13:13:03 +0000 Original-Received: from localhost ([127.0.0.1]:47389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQpBP-00049N-7B for submit@debbugs.gnu.org; Tue, 01 Aug 2023 09:13:03 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:35745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQpBN-00048s-Ov for 64986@debbugs.gnu.org; Tue, 01 Aug 2023 09:13:02 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id B1887240029 for <64986@debbugs.gnu.org>; Tue, 1 Aug 2023 15:12:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690895575; bh=p/nRSL2ShaxAwOUs0dzUvuDYJrclXyfrXqz4k5+0ZWY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=nc8q2nx/9CEkSDO511wd36DfFrT6TOm+8ZqBsPc9X9b7G9m2hnF5cYEfyJFbZoLt9 n4s7n0L83JbWSDXBsXIj7DH3+Kz4NNXlJ3j8PNVnylY1FpjaplMkxb9IgO3aqUV/cj hHNlfhU1qb9HXpmXAdM8tY2tQOlAUJmvCNTPl5xqc3VRxk7w/An8Tl8C5SH6pEgvcp jJViIdbNOq5RcE8nY7I5pj7DbmA7FeysXNpvl6w0a1Zy1ION29sOeZn3m95gIukzs/ G+4o+RW+eulk0s52GSrkXL6iT3EcMHYhL/icYJe8Mqo4rUcDICyp7rrhqhkQXIXacd dLryucjpswOyA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RFbBZ37Sqz9rxD; Tue, 1 Aug 2023 15:12:54 +0200 (CEST) In-Reply-To: <83pm470xuv.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:266449 Archived-At: Eli Zaretskii writes: > So what your code is doing is measure the size of the text of the > buffer shown in WINDOW (in your case, the selected window) between > buffer positions 1 and 2. And the buffer shown in the selected > window, the one created by org-test-with-temp-text-in-file, begins > with an empty line, so the function correctly returns zero as the > horizontal dimensions of the text. Ouch! Thanks for the explanation. > This tricky part is why we now have buffer-text-pixel-size: it takes > care of making the buffer "temporarily shown" in the window. So I > believe you should use that function instead. Indeed. We previously used `set-window-buffer' as in shr.el, but that felt like an awkward workaround because it can sometimes err when selected-window is dedicated. I am wondering if `shr-pixel-buffer-width' and `shr-pixel-column' should also use `buffer-text-pixel-size'. The `(set-window-dedicated-p nil nil)` is not nice as it could override user customization. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at