unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: bjdouma@xs2.xs4all.nl (Bauke Jan Douma)
Subject: signal-USR1-hook woes
Date: 08 Sep 2003 01:20:28 GMT	[thread overview]
Message-ID: <3f5bd95c$0$49102$e4fe514c@news.xs4all.nl> (raw)

Hi,

I am trying to get a list of currently open files in emacs, by
sending it SIGUSR1 (signo=10).  I have the following defines:

(defvar emacs-open-files "/root/emacs/.emacs-open-files" "List of files currently open in Emacs")

(defun list-emacs-open-files ()
	(interactive)
	
	(message "list-emacs-open-files: done")
	(let	(
		 (buf_list (buffer-list))
		)

		(with-temp-file emacs-open-files
			(while buf_list                                             	
				(cond	(
					 (buffer-file-name (car buf_list))
					 (insert (buffer-file-name (car buf_list)))
					 (insert "\n")
					)
				)
				(setq buf_list (cdr buf_list))
			)
		)
	)
)

(add-hook `signal-USR1-hook `list-emacs-open-files nil nil)

Alas, it doesn't work.  It does work from within emacs by
calling M-x list-emacs-open-files or by eval'ing
(signal-process (emacs-pid) 10).
When doing kill -USR1 <emacs-pid>, all that happens is I get a
visual bell, the file is not written.
An strace reveals that the signal is sent allright.

I am doing something wrong, but what?
Thanks!

bjd

             reply	other threads:[~2003-09-08  1:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-08  1:20 Bauke Jan Douma [this message]
2003-09-08  6:27 ` signal-USR1-hook woes Eli Zaretskii
     [not found] ` <mailman.344.1062998727.18171.help-gnu-emacs@gnu.org>
2004-02-29  5:50   ` Ed L Cashin

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='3f5bd95c$0$49102$e4fe514c@news.xs4all.nl' \
    --to=bjdouma@xs2.xs4all.nl \
    --cc=bjdouma@xs4all.nl \
    /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).