From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter 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 12:42:04 -0700 Message-ID: <5ae9ebbe-924a-5f8a-6630-12f009c96629@gmail.com> References: <875xrrr6x3.fsf@hw.ac.uk> <861q2fqt6r.fsf@gnu.org> <875xrrcgia.fsf@gmail.com> <3482d616-8a1c-d458-8da4-1b9d12ff32c5@gmail.com> <867cc6pi5b.fsf@gnu.org> <86ed6dn3ta.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------hgI8eI3MduC18ap7QRzkT4fO" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10832"; mail-complaints-to="usenet@ciao.gmane.io" Cc: R.Stewart@hw.ac.uk, 72771@debbugs.gnu.org, kevin.legouguec@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 24 21:44:45 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 1shwgl-0002gS-Rv for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Aug 2024 21:44:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shwgQ-0007Bz-92; Sat, 24 Aug 2024 15:44:22 -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 1shwgI-0007Au-EP for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 15:44:14 -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 1shwgH-0006kt-O4 for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 15:44:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=3A8en4TJOkArYX7eVP21poMBcHCTDcdv1IYiYsViU1A=; b=h7/bA0SKzss+tvUaEbdNANmB4GR2SFjeB374JBL46lPkianFHenniHcUwVll6TqDeMBNLTgn/ALFODM3HEJJdnJkEnd+cv6XHDLn5ZjXBRq/bThWI+wbGzlFaReH1Jykege1wGti7HLJz7kgOodB8keDKEGoCenNycNMNJTcSfg+rfoZUOcvBpaT1kb+0aor22N1xnngebi/Mr+diJVO7Do9907IeCmpl65IPnq2klOEquFgGsB66mnmffdDqoeLGl8ZRbsgeZ3Eb6J6V6Fo/zggC0wS8z1Na1eyHtBLoih5z0tx+J6csAfsITROhkv2VPljR4Mxn3Dv/Z7p721o7Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1shwh4-00011E-KI for bug-gnu-emacs@gnu.org; Sat, 24 Aug 2024 15:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Aug 2024 19:45:02 +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.17245286473828 (code B ref 72771); Sat, 24 Aug 2024 19:45:02 +0000 Original-Received: (at 72771) by debbugs.gnu.org; 24 Aug 2024 19:44:07 +0000 Original-Received: from localhost ([127.0.0.1]:41930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shwgA-0000zf-Qg for submit@debbugs.gnu.org; Sat, 24 Aug 2024 15:44:07 -0400 Original-Received: from mail-pj1-f48.google.com ([209.85.216.48]:59724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shwg5-0000yl-0S for 72771@debbugs.gnu.org; Sat, 24 Aug 2024 15:44:02 -0400 Original-Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-2d3eda6603cso2413515a91.3 for <72771@debbugs.gnu.org>; Sat, 24 Aug 2024 12:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724528526; x=1725133326; darn=debbugs.gnu.org; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=3A8en4TJOkArYX7eVP21poMBcHCTDcdv1IYiYsViU1A=; b=K66SrM3Hbq7I7Q6idR5wd6qqvrBeW1OrS+22BZ+ncsa6sPLMPNMGgwv5qJUsiQiEUH kVyHvp4TXM9S4M0PAHygFGOnj7L7wlX5r81om1SHOFa/lMp2mw+SE1S/JyxUJFa12XSb +mLghGDroLfz79X7efvXMy73h86cxldMhinzIJk0dK92L57e3SVNUFd8Juo8dYRTelju RtbRvzcp8m84Pf1FB21foUcY6nKA6UoyJGcXhPRCkmMdsfCFZpxbFjYJwOipEWwq8iT+ KYRifsJbi1YtJdFiLSiyERO5HTYcWv8Lds9R5akl4lewu3jcRZWFy+QZR+FKOH8dyC7d m80g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724528526; x=1725133326; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=3A8en4TJOkArYX7eVP21poMBcHCTDcdv1IYiYsViU1A=; b=Lw6KXuRH0WRbWgnHE32b4fvzkm2NfTsyYnYxi5RRkq5Gcm60cy28LhQNSULmCrkl8g 8Dkt2Yx2qhdf+X1cmWmSLnM0WyhlwMLmYuwSTf6V2ZPln7lbB+Op2gy1rWrC7VrkzI5w Jr94L4lkiv0QN/4RbS4eSzVf0NPihWKOksaNgqQUmILgr1ocKadEPIlKrhFZcFEzOuZN jr0U70lRojYlWSe2Y8OuZKgWeQ8Obx0EMeBqTKBG+F6wMIwXDr4m2NRG0DD6V29zofez 3r17QVvZQF8kyHcXNNc3MnJVQM6lRenm/eB3otKJt0B4nDmT0wfVk6S/IxA8jIYS/+wP 3AXQ== X-Forwarded-Encrypted: i=1; AJvYcCUXA2HvcSoHldMxyA5PIPjLZo4f3CI0AWc4xY/09VFcMqloc6Fc0i6AB8Bb3WFNdNAzz2GsWQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yy+4JQmuqBkFxkvlYZjwXP0T0WPBzXa+p1HQL0SZiVmq0yls66l /8V7QIUYqgkOfaVAm7WISbsHVe/LxfdLjPAzv0lsFU9FcluQjqzZ X-Google-Smtp-Source: AGHT+IHXl4+5OyFJnfZZF31U+zEObnjIkrdoYDolHHqwD+OlB5XgHTlLa6ALGGSuyY/dTPLYd9hojA== X-Received: by 2002:a17:90a:55ca:b0:2d3:c3e5:b51a with SMTP id 98e67ed59e1d1-2d646bbc075mr6230804a91.9.1724528526111; Sat, 24 Aug 2024 12:42:06 -0700 (PDT) Original-Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com. [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2d613af1468sm6512871a91.44.2024.08.24.12.42.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 24 Aug 2024 12:42:05 -0700 (PDT) Content-Language: en-US In-Reply-To: <86ed6dn3ta.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:290697 Archived-At: This is a multi-part message in MIME format. --------------hgI8eI3MduC18ap7QRzkT4fO Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/24/2024 12:01 PM, Eli Zaretskii wrote: >> Date: Sat, 24 Aug 2024 10:10:06 -0700 >> Cc: R.Stewart@hw.ac.uk, 72771@debbugs.gnu.org, kevin.legouguec@gmail.com >> From: Jim Porter >> >>> . 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) >> >> I think the problem is getting the actual face, which works for simple >> cases via 'get-text-property', but not for more complex ones, e.g. when >> the 'face' property is a list; 'face-font' raises an error in that case. >> Effectively what I want would be a Lisp version of >> 'face_at_buffer_position', but that requires a window object anyway, so >> I'm back to the original problem... > > What's wrong with face-at-point? I don't know if that gets me quite what I want; it seems to be equivalent to 'get-text-property' for this case. The real problem is that I can't pass a list of faces to 'face-font'. In a case like that, any one of the faces in the list could be setting the font, so I can't just pass the first face in the list (or some other simplification). I'm sure I could iterate over the faces, but that seems more complex than the 'font-at' trick. >>> . use buffer-text-pixel-size or string-pixel-width to measure the >>> width of a string of a single SPC character >> >> I think this wouldn't work since I want the average font width, not the >> width of SPC. > > Then use a few different characters and take their average width. Well, I just want the "average-width" parameter as reported by the font object (falling back to "space-width"), since Emacs has already computed that. Trying to re-approximate that already-computed value doesn't seem like the right thing to do when I can jump over a small hurdle to get the existing value. Then I also don't have to worry about the performance impact of computing the approximation many times (or finding a place to cache it). > And I think you place too much faith in the average-width parameter of > a font. It can fail you. The display engine uses: > > char_width = (font->average_width > ? font->average_width > : font->space_width); Thanks for prompting me to re-read the manual on this. I'd misinterpreted this passage in the documentation for 'query-font': > average-width > The average width of the font characters. If this is zero, Emacs uses > the value of space-width instead, when it calculates text layout on > display. Previously I thought it meant that this element of the vector would hold the average-width, or if that was zero, hold (a copy of) the space-width. But checking the code, I see that's not right, and I should be sure to mimic what the display engine does above. Maybe this passage could be reworded to something like this: "This value may be zero. In that case, for calculating text layout on display, Emacs will consult the space-width instead." (Or maybe this is just a "me" problem...) >> In light of the above, I think what I have now might be the best way to >> do it for the time being > > Do you still think that? Aside from the above issue with 'space-width', yes (fixed in the attached patch). The 'font-at' trick seems like it gets me the font object with the least amount of fuss, and then I can I can retrieve the pixel-size of the 'width' unit as used by the display engine when handling the pixel specification. Maybe some higher-level function would be useful here but I don't know if this is a very common thing people need to do either... --------------hgI8eI3MduC18ap7QRzkT4fO Content-Type: text/plain; charset=UTF-8; name="0001-Improve-computation-of-indent-depth-in-SHR-and-visua.patch" Content-Disposition: attachment; filename*0="0001-Improve-computation-of-indent-depth-in-SHR-and-visua.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSAwZWY5MDhlMzRlN2E3NWU4NGRjYWRiNGIwOWQ1ODNmYWFjYmQyYmJhIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IEZyaSwgMjMgQXVnIDIwMjQgMTU6MTE6MjQgLTA3MDAKU3ViamVjdDogW1BB VENIXSBJbXByb3ZlIGNvbXB1dGF0aW9uIG9mIGluZGVudCBkZXB0aCBpbiBTSFIgYW5kCiAn dmlzdWFsLXdyYXAtcHJlZml4LW1vZGUnCgpUaGlzIG1ldGhvZCBnZXRzIHRoZSBmb250IHRo YXQgd291bGQgYmUgdXNlZCBmb3IgdGhlIGN1cnJlbnQgd2luZG93IGZvcgp0aGUgdGV4dCBp biBxdWVzdGlvbi4g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IChwb2ludCkpKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgKGluZm8gKHF1ZXJ5LWZvbnQgZm9udCkpKQotICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgKC8gKGZsb2F0IHNoci1pbmRlbnRhdGlvbikgKGFyZWYgaW5mbyA3KSkKLSAg ICAgICAgICAgICAgICAgICAgICAgICAgICBzaHItaW5kZW50YXRpb24pCi0gICAgICAgICAg ICAgICAgICAgICAgICAgLiB3aWR0aCkpKSkKKyAgICAgICAgIGAoc3BhY2UgOndpZHRoCisg ICAgICAgICAgICAgICAgICgsKGlmLWxldCAoKHRleHQgKGJ1ZmZlci1zdWJzdHJpbmcgKDEt IChwb2ludCkpIChwb2ludCkpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmb250 IChmb250LWF0IDAgbmlsIHRleHQpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChp bmZvIChxdWVyeS1mb250IGZvbnQpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChh dmctd2lkdGggKGlmICgvPSAoYXJlZiBpbmZvIDcpIDApCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKGFyZWYgaW5mbyA3KQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAoYXJlZiBpbmZvIDYpKSkpCisgICAgICAgICAg ICAgICAgICAgICAgICgvIChmbG9hdCBzaHItaW5kZW50YXRpb24pIGF2Zy13aWR0aCkKKyAg ICAgICAgICAgICAgICAgICAgIHNoci1pbmRlbnRhdGlvbikKKyAgICAgICAgICAgICAgICAg IC4gd2lkdGgpKSkpCiAgICAgICAocHV0LXRleHQtcHJvcGVydHkgc3RhcnQgKCsgKHBvaW50 KSBwcmVmaXgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Noci1wcmVmaXgtbGVuZ3Ro ICgrIHByZWZpeCAoLSAocG9pbnQpIHN0YXJ0KSkpKSkpCiAKZGlmZiAtLWdpdCBhL2xpc3Av dmlzdWFsLXdyYXAuZWwgYi9saXNwL3Zpc3VhbC13cmFwLmVsCmluZGV4IDkwMmE5ZTQxYzVl Li5kMGM4N2ZkNmU5ZSAxMDA2NDQKLS0tIGEvbGlzcC92aXN1YWwtd3JhcC5lbAorKysgYi9s aXNwL3Zpc3VhbC13cmFwLmVsCkBAIC0xNjQsMTEgKzE2NCwxNSBAQCB2aXN1YWwtd3JhcC0t Y29udGVudC1wcmVmaXgKICAgICA7OyB3aWR0aCBvZiB0aGUgZmlyc3QtbGluZSBwcmVmaXgg aW4gY2Fub25pY2FsLXdpZHRoIGNoYXJhY3RlcnMuCiAgICAgOzsgVGhpcyBpcyB1c2VmdWwg aWYgdGhlIGZpcnN0LWxpbmUgcHJlZml4IHVzZXMgc29tZSB2ZXJ5LXdpZGUKICAgICA7OyBj aGFyYWN0ZXJzLgotICAgIChpZi1sZXQgKChmb250IChmb250LWF0IHBvc2l0aW9uKSkKLSAg ICAgICAgICAgICAoaW5mbyAocXVlcnktZm9udCBmb250KSkpCisgICAgKGlmLWxldCAoKHRl eHQgKGJ1ZmZlci1zdWJzdHJpbmcgcG9zaXRpb24gKDErIHBvc2l0aW9uKSkpCisgICAgICAg ICAgICAgKGZvbnQgKGZvbnQtYXQgMCBuaWwgdGV4dCkpCisgICAgICAgICAgICAgKGluZm8g KHF1ZXJ5LWZvbnQgZm9udCkpCisgICAgICAgICAgICAgKGF2Zy13aWR0aCAoaWYgKC89IChh cmVmIGluZm8gNykgMCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYXJlZiBpbmZv IDcpCisgICAgICAgICAgICAgICAgICAgICAgICAgIChhcmVmIGluZm8gNikpKSkKICAgICAg ICAgKG1heCAoc3RyaW5nLXdpZHRoIHByZWZpeCkKICAgICAgICAgICAgICAoY2VpbGluZyAo c3RyaW5nLXBpeGVsLXdpZHRoIHByZWZpeCAoY3VycmVudC1idWZmZXIpKQotICAgICAgICAg ICAgICAgICAgICAgIChhcmVmIGluZm8gNykpKQorICAgICAgICAgICAgICAgICAgICAgIGF2 Zy13aWR0aCkpCiAgICAgICA7OyBXZSBjb3VsZG4ndCBnZXQgdGhlIGZvbnQsIHNvIHdlJ3Jl IGluIGEgdGVybWluYWwgYW5kCiAgICAgICA7OyBgc3RyaW5nLXBpeGVsLXdpZHRoJyBpcyBy ZWFsbHkgcmV0dXJuaW5nIHRoZSBudW1iZXIgb2YgY29sdW1ucy4KICAgICAgIDs7IChUaGlz IGlzIGRpZmZlcmVudCBmcm9tIGBzdHJpbmctd2lkdGgnLCBzaW5jZSB0aGF0IGRvZXNuJ3QK QEAgLTE4OSw3ICsxOTMsNyBAQCB2aXN1YWwtd3JhcC1maWxsLWNvbnRleHQtcHJlZml4CiAg ICAgICAgICAgOzsgbWFrZSBtdWNoIHNlbnNlIChhbmQgaXMgcG9zaXRpdmVseSBoYXJtZnVs IGluCiAgICAgICAgICAgOzsgdGFza3BhcGVyLW1vZGUgd2hlcmUgcGFyYWdyYXBoLXN0YXJ0 IG1hdGNoZXMgZXZlcnl0aGluZykuCiAgICAgICAgICAgKG9yIChsZXQgKChwYXJhZ3JhcGgt c3RhcnQgcmVnZXhwLXVubWF0Y2hhYmxlKSkKLSAgICAgICAgICAgICAgICAgICAgKGZpbGwt Y29udGV4dC1wcmVmaXggYmVnIGVuZCkpCisgICAgICAgICAgICAgICAgKGZpbGwtY29udGV4 dC1wcmVmaXggYmVnIGVuZCkpCiAgICAgICAgICAgICAgICAgICA7OyBOb3RlOiBmaWxsLWNv bnRleHQtcHJlZml4IG1heSByZXR1cm4gbmlsOyBTZWU6CiAgICAgICAgICAgICAgICAgICA7 OyBodHRwOi8vYXJ0aWNsZS5nbWFuZS5vcmcvZ21hbmUuZW1hY3MuZGV2ZWwvMTU2Mjg1CiAg ICAgICAgICAgICAgICIiKSkKLS0gCjIuMjUuMQoK --------------hgI8eI3MduC18ap7QRzkT4fO--