[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: write-region bug ?
From: |
Jean-Christophe Helary |
Subject: |
Re: write-region bug ? |
Date: |
Sun, 5 Jan 2020 11:01:56 +0900 |
> On Jan 5, 2020, at 7:58, Stefan Monnier <address@hidden> wrote:
>
>>>>>> → for some reason, the foo.el buffer is now associated to bar.txt
>>>>> You asked for it.
>>>> Indeed, because the VISIT argument of write-region was non-nil, and
>>>> that's what it does. It's in the documentation.
>>>
>>> OTOH, the VISIT argument can't make sense when the text comes from
>>> a string rather than from a buffer.
>>
>> Why does it not make sense? FILENAME is still provided.
>
> VISIT basically tells that the buffer should be considered as
> visiting FILENAME. Here, we have VISIT and FILENAME but we don't have
> the buffer (except that by accident).
*Yes*, that's where I stopped understanding the documentation. Thank you for
pointing that out.
Even though I provide a string (START is an empty string in my case, but it
happens with any string), the function considers that START is nil and hence
instead of the provided string uses the whole buffer by default just *because*
VISIT is non-nil.
The documentation says:
`If START is a string, then ‘write-region’ writes or appends that string,
rather than text from the buffer.'
So I feel safe here.
But then:
`If VISIT is ‘t’, then Emacs establishes an association between the buffer and
the file: the buffer is then visiting that file.'
I guess I still have issues with understanding what "the buffer is then
*visiting* that file" means but it does seem to contradict the above
description of START.
Obviously, there is an issue here.
If it is intended that a non-nil VISIT resets the value of START to nil, or
overrides it that should be documented.
If it is not intended, then that's a bug.
Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
- write-region bug ?, Jean-Christophe Helary, 2020/01/02
- Re: write-region bug ?, Andreas Schwab, 2020/01/02
- Re: write-region bug ?, Jean-Christophe Helary, 2020/01/02
- Re: write-region bug ?, Eli Zaretskii, 2020/01/02
- Re: write-region bug ?, Jean-Christophe Helary, 2020/01/02
- Re: write-region bug ?, Stefan Monnier, 2020/01/04
- Re: write-region bug ?, Eli Zaretskii, 2020/01/04
- Re: write-region bug ?, Stefan Monnier, 2020/01/04
- Re: write-region bug ?,
Jean-Christophe Helary <=
- Re: write-region bug ?, Eli Zaretskii, 2020/01/04
- Re: write-region bug ?, Jean-Christophe Helary, 2020/01/05
- Re: write-region bug ?, Eli Zaretskii, 2020/01/05
- Re: write-region bug ?, Eli Zaretskii, 2020/01/04
- Re: write-region bug ?, Stefan Monnier, 2020/01/04
- Re: write-region bug ?, Eli Zaretskii, 2020/01/05
- Re: write-region bug ?, Stefan Monnier, 2020/01/05
- Re: write-region bug ?, Eli Zaretskii, 2020/01/05
- Re: write-region bug ?, Stefan Monnier, 2020/01/05
- Re: write-region bug ?, Jean-Christophe Helary, 2020/01/05