GNU bug report logs - #51995
29.0.50; `string-pixel-width' depends on the current window width

Previous Next

Package: emacs;

Reported by: Brahimi Saifullah <brahimi.saifullah <at> gmail.com>

Date: Sat, 20 Nov 2021 05:05:02 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Brahimi Saifullah <brahimi.saifullah <at> gmail.com>
Cc: 51995 <at> debbugs.gnu.org
Subject: bug#51995: 29.0.50; `string-pixel-width' depends on the current window width
Date: Sun, 21 Nov 2021 10:12:40 +0100
[Message part 1 (text/plain, inline)]
> I saw the warnings, but I'm unsure of their validity.
> Here are some benchmarks that I did.  Each form was run on a fresh emacs -Q.
> Apologies in advance if there is something wrong about them:
[...]
> (benchmark-run 100000
>    (with-temp-buffer
>      (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore")
>      (car (window-text-pixel-size
>            (current-buffer) (point-min) (point) 1000000))))
> ;; (8.006855 167 2.318854)
>
> It's a lot more efficient to use a buffer, but the difference
> between the limits themselves continue to be insignificant.

These examples are harmless.  Please try to test (1) with a large buffer
that has no newline characters and (2) with 'truncate-lines' non-nil.
'window-text-pixel-size' must be able to handle these cases gracefully
even if it's not geared to them.

Any clients of 'window-text-pixel-size' like 'string-pixel-width' can
easily set X-LIMIT to some sufficiently large value without affecting
the basic functionality of 'window-text-pixel-size'.

>> I hopefully fixed most of the issues here but cannot send you a patch at
>> the moment to test because my local copy is completely out of synch with
>> master.  So please bear with me.

Please try the attached patch (if it doesn't apply, I'll send you the
affected functions separately so you can apply the changes manually).

Thanks, martin
[buffer-text-pixel-size.diff (text/x-patch, attachment)]

This bug report was last modified 3 years and 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.