emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 48aacbf292 2/2: Make many seldom-used generalized variables o


From: Stefan Monnier
Subject: Re: master 48aacbf292 2/2: Make many seldom-used generalized variables obsolete
Date: Sat, 10 Sep 2022 10:21:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen [2022-09-10 08:45:45] wrote:
> Ihor Radchenko <yantar92@gmail.com> writes:
>> This commit also obsoleted a number of generalized variables used by
>> Org. In particular, `buffer-substring', and `buffer-string'.
>>
>> While it is indeed possible to set buffer contents without the above
>> variables, it cannot (AFAIK) be done using a single function call.
>> Would it be possible to provide a function replacement for setting a
>> buffer text in the whole buffer/buffer region?
>
> "Setting a buffer text" is something that is un-Emacsey, in my opinion.
> That is, (setf (buffer-substring ...) ...) is pretending that we're
> operating on some object, but instead we're altering global (buffer)
> state.

Ihor doesn't specifically ask to keep the generalized variable, but to
offer some straightforward replacement.

> Just delete and insert instead

That's indeed what `cl--set-buffer-substring` (the workhorse of the
current gv-expander) does, but it's not ideal: it should insert first
and then delete, so as to better preserve markers.

For this reason, I do think we should provide a function to do that.

>> Also, obsoleting `buffer-file-name' revealed one potentially concerning
>> fact about generalized variables. The expansion of `buffer-file-name'
>> setter, `set-visited-file-name' "... also renames the buffer to
>> correspond to the new file." I am now wondering if there are any
>> non-obvious side effects when using other generalized variables - there
>> is (AFAIK) no documentation about what exactly various setters for
>> generalized variables do other than occasional paragraph in the manual.
>
> All these obsoleted generalised variables had non-obvious side effects,
> which is why I obsoleted them.

+1


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]