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.devel Subject: Re: master a876c4d7a17: Improve SHR/EWW support for 'visual-wrap-prefix-mode' Date: Wed, 21 Aug 2024 12:01:50 -0700 Message-ID: <7ee89525-e77c-5f05-b8fe-384861aadff5@gmail.com> References: <172402253530.16373.1641341718329436871@vcs2.savannah.gnu.org> <20240818230855.B0A94C2BC6D@vcs2.savannah.gnu.org> <87o75lkbo5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25331"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?UTF-8?Q?K=c3=a9vin_Le_Gouguec?= , Eshel Yaron Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 21 21:02:54 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sgqbe-0006Qx-Bf for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Aug 2024 21:02:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgqal-00021T-Lm; Wed, 21 Aug 2024 15:01:59 -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 1sgqah-00021C-TP for emacs-devel@gnu.org; Wed, 21 Aug 2024 15:01:55 -0400 Original-Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sgqag-0001Vk-4F for emacs-devel@gnu.org; Wed, 21 Aug 2024 15:01:55 -0400 Original-Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-714226888dfso6340b3a.1 for ; Wed, 21 Aug 2024 12:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724266912; x=1724871712; darn=gnu.org; h=content-transfer-encoding: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=ExM8EytNP9aN1Y0iH9RNwL46gqSqheIUic47vXnoknU=; b=lFVHULeu0vul2cUB8sTCAfI65WCAk902SjSd9Il7a/hLGplkMJpOWByyiro4datumx hCKz0wCVEcgVKDdpbF63IWNbb9WTLjORoSRDOX8mZCV9Z3IwC8182VoHrqqNi9gD9GKL SlYUumBZPf8yjW8+2g1WAAjXS/YQIUf0FnrvFJfhbIztFfZ8BUzU6NoCqCjGLe7jfDg4 sMjmNiANa8MiYwnllkn2YMB1U/+fh5ld7aYV9zqWEZ6ZtDeCZsgzcaxWTzNOH0kAJZa/ J2i42EfhI0mavQt3K7dM5nO49ZHxNfgkKR1cKcjX2PDDZ1/k/up5v8HS7/XDsrawsvNd QDWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724266912; x=1724871712; h=content-transfer-encoding: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=ExM8EytNP9aN1Y0iH9RNwL46gqSqheIUic47vXnoknU=; b=Q/RAVm8soBDNwRyO3NaxizdkpygAcpAJzP2IatNtWgWnCD35NJC3OYuoyW02i9x2Hy PEBj/xH5lMGwRcRPGp3+Zn/mViIfJ+U18Si+mDIg3iSm1uTpRztIneCVfx1t1foxH7O/ n7geq44cDOSNuhbsS6vtVxEQiiYsGA5elA+gWdkEgC6kj1WCdn9LHOWrFtdOb1pAO4I9 40Cc2wxkLocuv8Io+3p3cx2ems+dVY+sHu9M8wR4acPG/oCHFG8PUXqhOKChZ6EOQWny BZBrvgnYTu3EliTqdmMmzeB2SxpGQqIiGz1VtkP9E2m9cc92I+ghfrXqUiXU+u/3+pgO wGCw== X-Gm-Message-State: AOJu0Yw28De8xy8lT37rPZkdpjRjbHnB3S0/kdjC0UdCYzuV4mJIHLEA xBHvNvRRjVzeyTah0UobWM0iN4sBxTExh40G9POiea2Y5JCTTCO2 X-Google-Smtp-Source: AGHT+IHSlJ3S659PODtAVGYSXqwRKcIqo3kdZHhDTY3xMkK0bJTESGwcM2/xR/TcJapJpLXcSi/DEQ== X-Received: by 2002:aa7:8892:0:b0:70e:98e3:1aef with SMTP id d2e1a72fcca58-714235b336dmr3277335b3a.29.1724266911741; Wed, 21 Aug 2024 12:01:51 -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 d2e1a72fcca58-7127af1d68dsm10658034b3a.178.2024.08.21.12.01.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Aug 2024 12:01:51 -0700 (PDT) Content-Language: en-US In-Reply-To: <87o75lkbo5.fsf@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323027 Archived-At: On 8/21/2024 10:50 AM, Kévin Le Gouguec wrote: > Eshel Yaron writes: > >> Hello Jim, >> >> Jim Porter writes: >> >>> branch: master >>> commit a876c4d7a17df152e3e78800c76ddf158f632ee5 >>> Author: Jim Porter >>> Commit: Jim Porter >>> >>> Improve SHR/EWW support for 'visual-wrap-prefix-mode' >>> >> [...] >> >> Thanks for this! >> >> It seems like this change breaks Elfeed though, namely: [snip] >> This call to font-at throws an error unless the current buffer happens >> to be displayed in the selected window. This affects elfeed-show-entry, >> for example. Thanks for noticing this. It'd be good to make the "get the average width of the font" bit work properly in all cases. That said, this is *also* a bug in Elfeed. SHR just works a lot better if the buffer is displayed in a window before rendering the HTML out. See . > diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el > index 902a9e41c5e..975ccab3adb 100644 > --- a/lisp/visual-wrap.el > +++ b/lisp/visual-wrap.el > @@ -164,7 +164,8 @@ visual-wrap--content-prefix > ;; width of the first-line prefix in canonical-width characters. > ;; This is useful if the first-line prefix uses some very-wide > ;; characters. > - (if-let ((font (font-at position)) > + (if-let ((window (get-buffer-window (current-buffer))) > + (font (font-at position window)) > (info (query-font font))) > (max (string-width prefix) > (ceiling (string-pixel-width prefix (current-buffer)) Assuming this is working for you, I think this patch makes sense and you can feel free to merge it.