GNU bug report logs -
#71370
30.0.50; Please un-obsolete buffer-substring as a generalized variable
Previous Next
Full log
Message #26 received at 71370 <at> debbugs.gnu.org (full text, mbox):
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.