From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.bugs Subject: bug#71370: 30.0.50; Please un-obsolete buffer-substring as a generalized variable Date: Thu, 27 Jun 2024 10:09:39 -0500 Message-ID: <1ea7303f-5e8f-4ff6-ab1a-5a97412c291b@alphapapa.net> References: <87iky4zedz.fsf@web.de> 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="40475"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 71370@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 27 17:10:33 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 1sMqlc-000AGG-Do for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Jun 2024 17:10:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMqlC-00024I-7H; Thu, 27 Jun 2024 11:10:06 -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 1sMql6-00023C-Ql for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 11:10:02 -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 1sMql5-0002Wo-0P for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 11:10:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sMql7-0001QR-TV for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 11:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Adam Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Jun 2024 15:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71370 X-GNU-PR-Package: emacs Original-Received: via spool by 71370-submit@debbugs.gnu.org id=B71370.17195009935456 (code B ref 71370); Thu, 27 Jun 2024 15:10:01 +0000 Original-Received: (at 71370) by debbugs.gnu.org; 27 Jun 2024 15:09:53 +0000 Original-Received: from localhost ([127.0.0.1]:43138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMqkz-0001Pw-GQ for submit@debbugs.gnu.org; Thu, 27 Jun 2024 11:09:53 -0400 Original-Received: from toucan.tulip.relay.mailchannels.net ([23.83.218.254]:43867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMqks-0001Pi-Qb for 71370@debbugs.gnu.org; Thu, 27 Jun 2024 11:09:51 -0400 X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id AA08254336B; Thu, 27 Jun 2024 15:09:41 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a271.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 0CCBA542514; Thu, 27 Jun 2024 15:09:41 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1719500981; a=rsa-sha256; cv=none; b=cm9tYFRHtrcOEm6fKUM8KrnM3kI7w7naA680AgFf68t9obWVeu4oZU4BM4fpituvS5fEBm 2rKI5g7JFTTVNkLIBTGPEukWsH5gM07wzX4KYb0K4iyulTa0MSdVQbca5y8SEqZ1YSzVTg fQAqBA4p4vP0Zx6XRDWrhsEPgEZpTUG5uLuBH6A2wuOkIXD5J5j9rA46dj4eTfDaWP+zin /ZzAmJCo/nPOt8Pn/wKN+zGDwmIIHUDh1n7gyvT11FHPV55zjCJlaWatK9pqqcie1mtx12 I0eOpKwdoaiH2b+BSZ9SzltprcgktEA86EHvTeYLJgFm3HohYDbwiUVShwUU7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1719500981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LVjAIRRGCJL7Nm5YxnMmsGxnGHyjssUNLy8nouQsYs4=; b=NGYd3AmLaf+IAaHHJQECQ3Lq1HDhJueOzLlp3HfKjsjz6qY7dhQaUR48sE+BBWEwYtdO55 IcDATa6gHqK7p+ZeJZK2LGPp9eGlvtZVBHIIAxbzyO2NXPrAqyFyEP0quOQS6MVu0FzBXW oL0fX6+upRmyuYv2ieGTVPZT/Z0N4eHTtQ1qKskAa4isaAjCkWBN6zjDV6XewtmMyNpr2/ y0MVdE6SHTo8YWhtUDOZ5u8BRG79HK+/KO5v2arQRb2wxbRIyYyPZBFCTsp8JrP+hYTWer 8d85tqpBLixNa8mbFpptsb9AeVWUV+PJkpoGSb+CRczEJ06hHEqvloo4BaKyLg== ARC-Authentication-Results: i=1; rspamd-7f76976655-5njl7; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@alphapapa.net X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|adam@alphapapa.net X-MailChannels-Auth-Id: dreamhost X-Tangy-Scare: 7eee486a2dd12d02_1719500981559_4173330759 X-MC-Loop-Signature: 1719500981559:2725552216 X-MC-Ingress-Time: 1719500981558 Original-Received: from pdx1-sub0-mail-a271.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.107.55.209 (trex/6.9.2); Thu, 27 Jun 2024 15:09:41 +0000 Original-Received: from [10.66.43.177] (unknown [91.193.232.98]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adam@alphapapa.net) by pdx1-sub0-mail-a271.dreamhost.com (Postfix) with ESMTPSA id 4W926X4CGgz2T; Thu, 27 Jun 2024 08:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1719500980; bh=LVjAIRRGCJL7Nm5YxnMmsGxnGHyjssUNLy8nouQsYs4=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=g9S642eXBmtli/m+ERvtzJ+kx3iC8YBdNrMf/Y35+i5o94O2tw8nKC9w487SlC3UX kTqTqmiopbgjouWEkCFgYeGi32nWB0ZOgf3NfU563JtL3BJprh0RMyJLlmguS4Dib4 5+ZsbWER1B4fOvB9OBBmrzW85CTBSJXY/5o5UKTR8vhR0Mn9DsRWuVIRmTV4XkmdH2 L0L9fR0aooBHshLi0a5Thddaj5HRGZ/qM1vIeUPbLwWgFIfx4xJ56/PugUCD6R2dFN KvXFs+3il0J4U1h6yfCbWvSbcHJ/yQAZFW/wizr5odzpVOHqGQiQEGpi35gWGEPy4H sukjPRCrVyqiA== Content-Language: en-US In-Reply-To: <87iky4zedz.fsf@web.de> 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:288028 Archived-At: Hi Michael, On 6/19/24 18:44, Michael Heerdegen wrote: > Adam Porter writes: > >> ┌──── >> │ (let ((inhibit-read-only t)) >> │ (setf (buffer-substring (oref (magit-current-section) start) >> │ (oref (magit-current-section) end)) >> │ "foobar\n")) >> └──── >> >> Otherwise, one would have to use `delete-region' and then `insert', >> which is more cumbersome and error-prone. > > I guess alternatively you could define a helper function and make that > `setf'able, like > > #+begin_src emacs-lisp > (defalias 'magit-buffer-substring #'buffer-substring) > (gv-define-simple-setter magit-buffer-substring > cl--set-buffer-substring) > #+end_src One could, but it would seem tedious and wasteful to have do that across tens or hundreds of Elisp packages that use this setter and have for years. The minor ambiguities you point out in one of your later messages are fair to note; however, they aren't new, and they don't appear to have discouraged use of this form in practice. On the contrary, the form appears to be widely useful and understood easily enough. Given that Emacs is full of idiosyncrasies which are much more impactful and challenging to understand, I'd think that it would be sufficient to document this one in the Elisp manual, like others are. I'd certainly rather do that than deprive users of this useful, simple idiom which is already widely used. --Adam