help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Persistence of variables


From: Eli Zaretskii
Subject: Re: Persistence of variables
Date: Thu, 22 Mar 2018 09:02:07 +0200

> From: Rolf Ade <rolf@pointsman.de>
> Date: Thu, 22 Mar 2018 02:36:56 +0100
> 
> >> (defun write-string-to-file (string file)
> >>   "Write STRING to FILE.
> >> Create nonexistent FILE otherwise overwrite."
> >>   (interactive "sstring: \nFfile: ")
> >>   (with-temp-file file
> >>     (insert string "\n") ))
> >
> > We have append-to-file, which can do this out of the box.
> 
> I'm sorry to nit, but Emanuels write-string-to-file differs from
> append-to-file in that it ensures the file includes (only) string while
> append-to-file, well, appends string to the file at the end, if it
> exists.

And I'm sorry to nit back, but creating an empty file is trivial, in
which case append-to-file will do the same job.

More to the point, I think this feature of append-to-file is largely
unknown, which is why I made a point of mentioning it.  (Btw,
write-region supports a very similar feature.)



reply via email to

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