Subject: bug#71370: 30.0.50; Please un-obsolete buffer-substring as a generalized variable

From: Michael Heerdegen <[email-masked]>
Date: Thu, 20 Jun 2024 01:44:40 +0200

Adam Porter <[email-masked]> 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

Michael.