From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikolaj Schumacher Newsgroups: gmane.emacs.help Subject: Re: elisp: howto save not-visible buffer Date: Sat, 25 Apr 2009 08:49:32 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1240642216 23587 80.91.229.12 (25 Apr 2009 06:50:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Apr 2009 06:50:16 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Michal Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 25 08:51:35 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LxbjZ-0004MD-6C for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Apr 2009 08:51:33 +0200 Original-Received: from localhost ([127.0.0.1]:41036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lxbi9-00070k-Eu for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Apr 2009 02:50:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lxbhn-00070f-6V for help-gnu-emacs@gnu.org; Sat, 25 Apr 2009 02:49:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lxbhk-00070T-Of for help-gnu-emacs@gnu.org; Sat, 25 Apr 2009 02:49:41 -0400 Original-Received: from [199.232.76.173] (port=53185 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lxbhk-00070Q-IM for help-gnu-emacs@gnu.org; Sat, 25 Apr 2009 02:49:40 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:42321) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lxbhk-0004I3-0T for help-gnu-emacs@gnu.org; Sat, 25 Apr 2009 02:49:40 -0400 Original-Received: from dd18200.kasserver.com ([85.13.138.168]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lxbhj-0000j1-1H for help-gnu-emacs@gnu.org; Sat, 25 Apr 2009 02:49:39 -0400 Original-Received: from thursday.local (f050226006.adsl.alicedsl.de [78.50.226.6]) by dd18200.kasserver.com (Postfix) with ESMTP id BA65D182131F3; Sat, 25 Apr 2009 08:49:34 +0200 (CEST) In-Reply-To: (Michal's message of "Fri, 24 Apr 2009 16:44:24 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (darwin) X-detected-kernel: by mx20.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:64015 Archived-At: Michal 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. regards, Nikolaj Schumacher