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: Anselm Helbig
Subject: Re: elisp: howto save not-visible buffer
Date: Fri, 24 Apr 2009 22:14:58 +0200
User-agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.7 Emacs/22.3 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

Hi!

> Hallo,
>  can I save buffer that is not current one?
> 
> something like that:
> (setq buf (find-file-noselect "/some/file"))
> (save-buffer buf)
> 
> I see that 'save-buffer' does not get any parameter:(

Well, then you should make the buffer you want to save the current one:

  (save-excursion 
    (set-buffer (setq buf (find-file-noselect "/some/file")))
    (save-buffer buf))

save-excursion will make sure that the current buffer is restored when
you're done.

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


reply via email to

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