unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>,
	"Eshel Yaron" <me@eshelyaron.com>
Cc: emacs-devel@gnu.org
Subject: Re: master a876c4d7a17: Improve SHR/EWW support for 'visual-wrap-prefix-mode'
Date: Wed, 21 Aug 2024 12:01:50 -0700	[thread overview]
Message-ID: <7ee89525-e77c-5f05-b8fe-384861aadff5@gmail.com> (raw)
In-Reply-To: <87o75lkbo5.fsf@gmail.com>

On 8/21/2024 10:50 AM, Kévin Le Gouguec wrote:
> Eshel Yaron <me@eshelyaron.com> writes:
> 
>> Hello Jim,
>>
>> Jim Porter <jporterbugs@gmail.com> writes:
>>
>>> branch: master
>>> commit a876c4d7a17df152e3e78800c76ddf158f632ee5
>>> Author: Jim Porter <jporterbugs@gmail.com>
>>> Commit: Jim Porter <jporterbugs@gmail.com>
>>>
>>>      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 <https://github.com/skeeto/elfeed/pull/521>.

> 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.



      reply	other threads:[~2024-08-21 19:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <172402253530.16373.1641341718329436871@vcs2.savannah.gnu.org>
     [not found] ` <20240818230855.B0A94C2BC6D@vcs2.savannah.gnu.org>
2024-08-21 11:33   ` master a876c4d7a17: Improve SHR/EWW support for 'visual-wrap-prefix-mode' Eshel Yaron
2024-08-21 17:50     ` Kévin Le Gouguec
2024-08-21 19:01       ` Jim Porter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ee89525-e77c-5f05-b8fe-384861aadff5@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=kevin.legouguec@gmail.com \
    --cc=me@eshelyaron.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).