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 #26 received at 71370 <at> debbugs.gnu.org (full text, mbox):

From: Adam Porter <adam <at> alphapapa.net>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 71370 <at> debbugs.gnu.org
Subject: Re: bug#71370: 30.0.50; Please un-obsolete buffer-substring as a
 generalized variable
Date: Wed, 19 Jun 2024 23:05:50 -0500
Hi Michael,

On 6/19/24 18:44, Michael Heerdegen wrote:
> Adam Porter <adam <at> alphapapa.net> 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

I guess one could, but that would seem like making use of the 
marked-obsolete functionality in a roundabout way, and I'd guess that if 
it were eventually deprecated and removed, that would stop working, too 
(which one could work around by importing all of the old code, but it 
would be simpler to not obsolete it in the first place).

--Adam,
  who will one day be marked obsolete,
  but whose time has not yet come,
  either.  ;)




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.