GNU bug report logs - #71370
30.0.50; Please un-obsolete buffer-substring as a generalized variable

Previous Next

Package: emacs;

Reported by: Adam Porter <adam <at> alphapapa.net>

Date: Wed, 5 Jun 2024 01:34:02 UTC

Severity: wishlist

Found in version 30.0.50

Full log


Message #112 received at 71370 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71370 <at> debbugs.gnu.org, yantar92 <at> posteo.net, michael_heerdegen <at> web.de,
 monnier <at> iro.umontreal.ca, adam <at> alphapapa.net, acorallo <at> gnu.org,
 spwhitton <at> spwhitton.name
Subject: Re: bug#71370: 30.0.50; Please un-obsolete buffer-substring as a
 generalized variable
Date: Sun, 23 Mar 2025 14:33:48 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 71370 <at> debbugs.gnu.org, Ihor Radchenko <yantar92 <at> posteo.net>,
>>  Stefan Monnier <monnier <at> iro.umontreal.ca>, Adam Porter <adam <at> alphapapa.net>,
>>  Andrea Corallo <acorallo <at> gnu.org>, Sean Whitton <spwhitton <at> spwhitton.name>
>> From: Stefan Kangas <stefankangas <at> gmail.com>
>> Date: Sun, 23 Mar 2025 12:48:26 +0000
>>
>> Stefan Kangas <stefankangas <at> gmail.com> writes:
>>
>> > Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>> >
>> >> Stefan Kangas <stefankangas <at> gmail.com> writes:
>> >>
>> >>> If not, I think what Sean writes above is the way to go.
>> >>
>> >> What about what I said and Sean agreed to?  Did you read my replies?
>> >
>> > Yes, if you mean this part:
>> >
>> >         Please let's keep those two separate questions separate: (1) is a
>> >         certain functionality useful, and (2) if it is, should it be provided,
>> >         maybe even only, as a gv setter function.
>> >
>> > As for `buffer-substring`, if we can't have a function that provides
>> > that functionality (the proposed `replace-region`), then (setf
>> > (buffer-substring ...) ...) is clearly _not_ obsolete and shouldn't be
>> > marked as such.
>> >
>> > As for `buffer-string`, I don't know any proposed replacement function,
>> > so I think it's not obsolete on these grounds too.  FWIW, I don't see a
>> > huge need for a replacement function, and I think a generalized variable
>> > is perfectly serviceable in that case.
>>
>> It seems like we can't find agreement on a way forward for adding
>> `replace-region` in Bug#76313, or even on which functions to obsolete
>> or how.
>
> That is not a necessary condition for making buffer-substring a
> generalized variable.  We could have an internal function, maybe not
> even exposed to Lisp, to replace the buffer substring.  That will not
> solve the more general replace-region dispute, but no one said we must
> always kill all the birds in one blow.

I'm not sure we need to do that much, at least not immediately.

The change I propose to make is just this:

diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index b44f7dc87f3..380631d9ac6 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -682,10 +682,8 @@ buffer-name

 (gv-define-setter buffer-string (store)
   `(insert (prog1 ,store (erase-buffer))))
-(make-obsolete-generalized-variable 'buffer-string nil "29.1")

 (gv-define-simple-setter buffer-substring cl--set-buffer-substring)
-(make-obsolete-generalized-variable 'buffer-substring nil "29.1")

 (gv-define-simple-setter current-buffer set-buffer)
 (make-obsolete-generalized-variable 'current-buffer 'set-buffer "29.1")




This bug report was last modified 85 days ago.

Previous Next


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