From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Ponce via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72689: 31.0.50; Proposal to improve string-pixel-width Date: Sat, 31 Aug 2024 12:51:52 +0200 Message-ID: <3a66affe-a0b6-47a9-8b76-271da619df85@orange.fr> References: <54d1d667-55d0-41fc-9eec-38b3881d799b@orange.fr> <86bk1q1m0l.fsf@gnu.org> <8634n219b1.fsf@gnu.org> <35119d55-c582-4f4b-b80d-d94fc6b8886c@orange.fr> <86jzgauiav.fsf@gnu.org> <358cf360-aa39-4551-aa8f-46543df07eda@orange.fr> <86seuxte6r.fsf@gnu.org> <867cc8u8lj.fsf@gnu.org> <86ed65cd2k.fsf@gnu.org> Reply-To: David Ponce Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3372"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 72689-done@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 31 12:52:27 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 1skLiV-0000i4-32 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 31 Aug 2024 12:52:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1skLiC-0002jc-4q; Sat, 31 Aug 2024 06:52:08 -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 1skLi8-0002jB-Na for bug-gnu-emacs@gnu.org; Sat, 31 Aug 2024 06:52:04 -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 1skLi8-0005KY-BV for bug-gnu-emacs@gnu.org; Sat, 31 Aug 2024 06:52:04 -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=LiaR7f9qRXW9oWmgEiTZStxIA7begSIiuEMX3VClVNg=; b=aF2m7+MZ44KpyMPSC3FX/0yUDqAv0d6NPsm/v+pi54GbWr5cfeDAEjDjibgGYqW90lGfx/dUt9qxBz8XnYD1AUaSoSJDM5BkbPTDfFVbzUby2htTVD286rhGzxd+qei8G46Y8VcU1QOugqgFmz8hAUH9LU2ytqfz/PcL3NMh1vYURUt2e3K0ZOTTCi7Kz0GoSDtqjob7zwrGzRjErPdmvyI6wHTpdYasJJtBFOJUXKmhjdpz923rCb8U2wMmH7t3bJRZtcQEXXmcJpmcveUE+IfXRM14Ks0BDaoxfoLFwiE8SQyn/9nrPCoAKORgY4J1yrVaYJp/PfXtY1l3a87eVg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1skLj3-0002lU-VD for bug-gnu-emacs@gnu.org; Sat, 31 Aug 2024 06:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 31 Aug 2024 10:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72689 X-GNU-PR-Package: emacs Original-Received: via spool by 72689-done@debbugs.gnu.org id=D72689.172510157710616 (code D ref 72689); Sat, 31 Aug 2024 10:53:01 +0000 Original-Received: (at 72689-done) by debbugs.gnu.org; 31 Aug 2024 10:52:57 +0000 Original-Received: from localhost ([127.0.0.1]:54048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1skLiz-0002l9-E9 for submit@debbugs.gnu.org; Sat, 31 Aug 2024 06:52:57 -0400 Original-Received: from msa-216.smtpout.orange.fr ([193.252.23.216]:60638 helo=msa.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1skLiw-0002l0-Gi for 72689-done@debbugs.gnu.org; Sat, 31 Aug 2024 06:52:55 -0400 Original-Received: from [192.168.1.21] ([2.7.225.247]) by smtp.orange.fr with ESMTPA id kLhwsTosiQaX2kLhws90pY; Sat, 31 Aug 2024 12:51:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1725101515; bh=LiaR7f9qRXW9oWmgEiTZStxIA7begSIiuEMX3VClVNg=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=NV0fbzuU5LUz3nUcPcHhsGeWaYzHfmxAfu+Dgh97vrKEb2KNDfyHwU0PY2EdL7SEF kSpYfoWr4A9ETnPi+IEdgCS8gqpECQA5dktsg1F6nJKpAGk7Du6sBvtO+GCVk3AKC/ HsBgwc9DuCcoDaJ636lhc7mriQrhG9DuaoUSgGaUh33VIP0rnYORT4PKUEixhCVT/P yBHQO9tiR0drA616H6Kskt7LftGi0OIZv9Xl9paGuSRytGjtdZWleXy4c99bWD3FZR 1p+ZCvKHnSvYh8nnmuxyO2HuCpCVpqoMezxYvTWDz9pmdWjtyu0y25pJNh+JNNEHFp 75K66BnI8qghA== X-ME-Helo: [192.168.1.21] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Sat, 31 Aug 2024 12:51:55 +0200 X-ME-IP: 2.7.225.247 Content-Language: fr, en-US In-Reply-To: <86ed65cd2k.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:291008 Archived-At: On 31/08/2024 10:26 AM, Eli Zaretskii wrote: >> Date: Thu, 22 Aug 2024 16:56:11 +0200 >> Cc: 72689@debbugs.gnu.org >> From: David Ponce >> >>> 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!