unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: emacsclient: controlling from an application?
Date: Wed, 15 Oct 2003 18:24:25 GMT	[thread overview]
Message-ID: <jwvvfqq1iqs.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca> (raw)
In-Reply-To: VFfjb.1604$bI1.339493913@twister1.starband.net

> 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 <emacs process>' 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

  reply	other threads:[~2003-10-15 18:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-15 17:41 emacsclient: controlling from an application? DrMemory
2003-10-15 18:24 ` Stefan Monnier [this message]
2003-10-15 18:44   ` Stefan Monnier
2003-10-15 19:03     ` Stefan Monnier
2003-10-15 21:58   ` DrMemory
2003-10-16 15:17     ` Kevin Rodgers
2003-10-16 16:48       ` DrMemory
2003-10-16 19:00         ` Stefan Monnier
2003-10-15 18:25 ` Kevin Rodgers
2003-10-15 20:36   ` DrMemory
2003-10-15 21:04     ` Stefan Monnier
2003-10-17 22:45       ` DrMemory
2003-10-20 16:58         ` Kevin Rodgers
2003-10-15 20:46 ` DrMemory
2003-10-15 20:57   ` DrMemory
2003-12-01 21:40 ` Kai Grossjohann

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvvfqq1iqs.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca \
    --to=monnier@iro.umontreal.ca \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).