From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: emacsclient: controlling from an application? Date: Wed, 15 Oct 2003 18:24:25 GMT Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1066242713 16642 80.91.224.253 (15 Oct 2003 18:31:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Oct 2003 18:31:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 15 20:31:51 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A9qR4-0004pm-01 for ; Wed, 15 Oct 2003 20:31:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A9qQm-0001Gm-QI for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Oct 2003 14:31:32 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.nuthinbutnews.com!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-NNTP-Posting-Host: 132.204.24.42 Original-X-Complaints-To: abuse@umontreal.ca Original-X-Trace: charlie.risq.qc.ca 1066242265 132.204.24.42 (Wed, 15 Oct 2003 14:24:25 EDT) Original-NNTP-Posting-Date: Wed, 15 Oct 2003 14:24:25 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:117282 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13211 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13211 > I would like to have a cron task signal emacsclient to save a certain > buffer which I keep open throughout the workday, so that a perl script > can do some processing on the contents at the end of the day. > Signalling to save _all_ buffers would be okay too. You can use `kill -USR1 ' in your cron job and something akin to (add-hook 'signal-USR1-hook 'save-some-buffers). Same thing with USR2 of course. I've never tried it, tho. If you use Emacs-CVS you can also use something like `emacsclient --eval "(save-some-buffers)"' and if your Emacs is older, you can do the same with gnuserv/gnuclient. > I know I can set the auto-save-visited-file-name variable so that > auto-saves write to the original file; I recommend you don't do that. The auto-save file is written using Emacs's internal encoding of characters, so unless you stick to pure ASCII, you will get incorrect results. And Emacs will be all confused, thinking that some external process is modifying the file. But you could use a timer to save this specific buffer every once in a while. Something like (run-with-idle-timer 60 'repeat (lambda () (let ((buf (get-buffer "the bufferIwanttosave"))) (if buf (with-current-buffer buf (save-buffer)))))) -- Stefan