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


View this message in rfc822 format

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Adam Porter <adam <at> alphapapa.net>, 71370 <at> debbugs.gnu.org
Subject: bug#71370: 30.0.50; Please un-obsolete buffer-substring as a generalized variable
Date: Wed, 05 Jun 2024 12:09:40 +0000
Eli Zaretskii <eliz <at> gnu.org> 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 don't understand why it would be cumbersome, let alone error-prone.
> Less convenient than using setf, yes, but "cumbersome"?  We've been
> doing that for decades.

setf is still a lot more convenient. It is also fairly commonly used -
Org mode did use it; github search reveals pretty frequent use in
packages and configs; I stumbled upon this warning a number of times
when compiling the packages I load in my config.

So, if the only reason to obsolete `buffer-substring' is that it is
unused, I'd prefer it not to be obsoleted.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




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.