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

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

Re: elisp: howto save not-visible buffer


From: Michal
Subject: Re: elisp: howto save not-visible buffer
Date: Mon, 27 Apr 2009 12:45:25 +0200
User-agent: mozilla news reader

Nikolaj Schumacher <me@nschum.de> writes:

> Michal <rabbitko@tenbit.pl> wrote:
>
>>  can I save buffer that is not current one?
>>
>> something like that:
>> (setq buf (find-file-noselect "/some/file"))
>> (save-buffer buf)
>
> (with-current-buffer (find-file-noselect "/some/file"))
>   (save-buffer))
>
> But what you really want to do is probably:
>
> (let ((buf (find-buffer-visiting "/some-file")))
>   (when buf
>     (with-current-buffer buf
>       (save-buffer))))
>
> Because you probably don't want to find the file if it isn't already
> open.
>

Nikolaj, Thanks for Your help!

best regards,
Michal




reply via email to

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