From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72771: 31.0.50; shr html renderer throwing "Specified window is not displaying the current buffer" Date: Sat, 24 Aug 2024 09:08:32 +0300 Message-ID: <867cc6pi5b.fsf@gnu.org> References: <875xrrr6x3.fsf@hw.ac.uk> <861q2fqt6r.fsf@gnu.org> <875xrrcgia.fsf@gmail.com> <3482d616-8a1c-d458-8da4-1b9d12ff32c5@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12631"; mail-complaints-to="usenet@ciao.gmane.io" Cc: R.Stewart@hw.ac.uk, 72771@debbugs.gnu.org, kevin.legouguec@gmail.com To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 24 08:09:36 2024 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 1shjxv-00039k-AK for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Aug 2024 08:09:35 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shjxf-0006J4-NN; Sat, 24 Aug 2024 02:09:19 -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 1shjxd-0006It-NN for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 02:09:17 -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 1shjxa-0003Wa-59 for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 02:09:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=rEtd8n7a44NTCxh3OTVIghmbo+tSC5So9daex7hBvVk=; b=LPMkarh4aDP/94orOcSsNJXXGTo71BwweK4fWEOoKGiGau/K47ONhUI23OhyPHLTXn094KHX/jwmZlkjP1mLqVJlr37MNSYBJj+a+eNbh8LO3oaFdSZNxV89dZCAdvB5m0RD3myAfe93V7Q/EaYvvxXPE7NRpRv4UVr5hhk/zdjsT7LLR00HbZhXRsNuRVrFhEWMsFgyhh94DUR1hyUo+B2Rl55vDxK1C0D6y+1UUU1EHuJVfdRXQ+lcbIYJ05/3uqdseqVtfDbk/bQbHsSHH6AhYebhJdXK5Lu2lcbsRcrNx2AgJmtd66+5cWIklfmESL+oqwbaDzZYJ9eAFVPH3Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1shjyL-0002v3-TB for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 02:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Aug 2024 06:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72771 X-GNU-PR-Package: emacs Original-Received: via spool by 72771-submit@debbugs.gnu.org id=B72771.172447977211173 (code B ref 72771); Sat, 24 Aug 2024 06:10:01 +0000 Original-Received: (at 72771) by debbugs.gnu.org; 24 Aug 2024 06:09:32 +0000 Original-Received: from localhost ([127.0.0.1]:40284 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shjxs-0002u9-4B for submit@debbugs.gnu.org; Sat, 24 Aug 2024 02:09:32 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shjxp-0002tr-5d for 72771@debbugs.gnu.org; Sat, 24 Aug 2024 02:09:30 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shjww-0003UB-Os; Sat, 24 Aug 2024 02:08:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rEtd8n7a44NTCxh3OTVIghmbo+tSC5So9daex7hBvVk=; b=Mk0iwPZd6Td8 da5n/5uUy8A+ihua1fnM6+R6ZZAt6iBz+NKT64CgPFpk2h9uBw7xJG/aKa56ZAZU43CLrKB/no7Ya w1u0a9HbhHlgHbPmRaDEJbNj1D3RkAuKHOeAWgFb+z0Dn6tVdfQGkYtr5vF4HcV5k2/JZ+lsygoMw fNVolIg4jbLQRMlZxpTSQYDTepPzH2SszzWv6at524Jhqvu3pdT65rrh+UWk338QKnW4sTK+6LA2i wF7jnFqzskERlg8X1mosc1KFGTRrL2JjsWPqtIDV8GrqDcc38J7oDjl1axcnIQYCLql8vU+6eDwat 3562GPL6xjdQL0lQOrMHQQ==; In-Reply-To: <3482d616-8a1c-d458-8da4-1b9d12ff32c5@gmail.com> (message from Jim Porter on Fri, 23 Aug 2024 15:39:00 -0700) 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:290620 Archived-At: > Date: Fri, 23 Aug 2024 15:39:00 -0700 > Cc: Rob Stewart , 72771@debbugs.gnu.org > From: Jim Porter > > Here's a patch. I've tested this in a few configurations (in the current > window, in a buffer that's not being displayed, in a terminal Emacs) and > it all seems to work. > > One question, Eli: is there a better way than I'm using to get the font > that would be used for a character in the buffer? When the buffer is > being displayed in a window, '(font-at position window)' works, but that > doesn't address this bug, where the buffer isn't displayed. (The font > that we get back doesn't have to be 100% accurate; just a good guess > should be fine for this case.) AFAIU, the code needs the width of the space character of a font used to show some text, is that correct? And the patch solves the problem of font-at by pretending that the relevant text is displayed in the current window, is that correct? Alternatives to the solution in the patch are: . temporarily display the buffer in some window (if there is already a window showing the buffer, use with-selected-window) . use buffer-text-pixel-size or string-pixel-width to measure the width of a string of a single SPC character . use the font obtained from (face-font 'default) (or the actual face of the text, if you can get at it easily), like this: (aref (font-info (face-font 'default)) 10)