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

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

Re: Persistence of variables


From: Rolf Ade
Subject: Re: Persistence of variables
Date: Thu, 22 Mar 2018 02:36:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:
>> From: Emanuel Berg <moasen@zoho.com>
>> Date: Wed, 21 Mar 2018 19:00:52 +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.

That makes write-string-to-file are more useful building block in the
context of the question of the OP, IMHO. But it's musing anyway.


reply via email to

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