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

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

Re: How to programmatically save a buffer?


From: Pascal J. Bourguignon
Subject: Re: How to programmatically save a buffer?
Date: Tue, 17 Nov 2015 23:41:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> Hi there,
>
> as part of a function of mine, I want to save a buffer.  However, I do
> not want any messages logged (as save-buffer does).  I found this in the
> manual:
>
> You can write the contents of a buffer, or part of a buffer, directly to
> a file on disk using the ‘append-to-file’ and ‘write-region’ functions.
> Don’t use these functions to write to files that are being visited; that
> could cause confusion in the mechanisms for visiting.
>
> Why shouldn't I use `write-region'?

Because find-file doesn't necessarily put the file contents in the
buffer, but some "formatted" or "extracted" version of if.

You may try basic-save-buffer
which writes a message only if no save was needed.

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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