GNU bug report logs -
#72689
31.0.50; Proposal to improve string-pixel-width
Previous Next
Reported by: David Ponce <da_vid <at> orange.fr>
Date: Sat, 17 Aug 2024 22:05:01 UTC
Severity: normal
Found in version 31.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 31/08/2024 10:26 AM, Eli Zaretskii wrote:
>> Date: Thu, 22 Aug 2024 16:56:11 +0200
>> Cc: 72689 <at> debbugs.gnu.org
>> From: David Ponce <da_vid <at> orange.fr>
>>
>>> LGTM, thanks.
>>
>> Thanks. Please find attached 2 patches:
>>
>> 1. with-work-buffer.patch to introduce the new macro with-work-buffer.
>>
>> 2. string-pixel-width.patch to improve `string-pixel-width'.
>
> Thanks, installed on the master branch, and closing the bug.
Many thanks!
Looking at the new version of string-pixel-width, I realized that I left
a call to erase-buffer that is not necessary. Leaving it is not a problem,
but it would save a function call to remove it.
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 83528f5c5dd..4cdb065feeb 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -405,7 +405,6 @@ string-pixel-width
(with-current-buffer buffer
face-remapping-alist))
(kill-local-variable 'face-remapping-alist))
- (erase-buffer)
(insert string)
;; Prefer `remove-text-properties' to `propertize' to avoid
;; creating a new string on each call.
>
> Please in the future try to submit patches using "git format-patch",
> as that makes the patches easier to apply.
Ok, I will have study this command.
I'm afraid I only use git in a very basic way.
Many thanks for your help!
This bug report was last modified 263 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.