emacs-devel
[Top][All Lists]
Advanced

[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 14:14:29 +0900


> On Jan 5, 2020, at 12:33, Eli Zaretskii <address@hidden> wrote:
> 
>> From: Jean-Christophe Helary <address@hidden>
>> Date: Sun, 5 Jan 2020 11:01:56 +0900
>> 
>>> 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.
> 
> Please make sure you read the doc string as it is on the latest
> emacs-27 branch (or master).


DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 7,
       "r\nFWrite region to file: \ni\ni\ni\np",
       doc: /* Write current region into specified file.
When called from a program, requires three arguments:
START, END and FILENAME.  START and END are normally buffer positions
specifying the part of the buffer to write.
If START is nil, that means to use the entire buffer contents; END is
ignored.

*** If START is a string, then output that string to the file
instead of any buffer contents; END is ignored. ***

Optional fourth argument APPEND if non-nil means
  append to existing file contents (if any).  If it is a number,
  seek to that offset in the file before writing.
Optional fifth argument VISIT, if t or a string, means
  set the last-save-file-modtime of buffer to this file's modtime
  and mark buffer not modified.

*** If VISIT is t, the buffer is marked as visiting FILENAME. ***


So, practically speaking, the START string is output to the file, and then, the 
buffer is "marked as visiting FILENAME" which practically speaking means that 
it overwrites the START string.

What is that for ?

Jean-Christophe Helary


reply via email to

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