help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

signal-USR1-hook woes


From: Bauke Jan Douma
Subject: signal-USR1-hook woes
Date: 08 Sep 2003 01:20:28 GMT

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 via email to

[Prev in Thread] Current Thread [Next in Thread]