all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Anselm Helbig <anselm.helbig+news2009@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: elisp: howto save not-visible buffer
Date: Fri, 24 Apr 2009 22:14:58 +0200	[thread overview]
Message-ID: <87bpqln70d.wl%anselm.helbig+news2009@googlemail.com> (raw)
In-Reply-To: <m2zle6w1pz.fsf@tenbit.pl>

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	other threads:[~2009-04-24 20:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-24 14:44 elisp: howto save not-visible buffer Michal
2009-04-24 20:14 ` Anselm Helbig [this message]
2009-04-25  6:49 ` Nikolaj Schumacher
2009-04-27 10:45   ` Michal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bpqln70d.wl%anselm.helbig+news2009@googlemail.com \
    --to=anselm.helbig+news2009@googlemail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.