[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to successively log stuff to a file?
From: |
Stephen Berman |
Subject: |
Re: How to successively log stuff to a file? |
Date: |
Tue, 04 Feb 2014 13:36:05 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
On Tue, 04 Feb 2014 00:41:00 +0100 Michael Heerdegen <address@hidden> wrote:
> Hello,
>
> I have written a little library for logging stuff, i.e. hit keys and
> executed commands, messages, and file loads [1].
>
> I want that you can define a dribble file where all my logged output
> would be written to. That would be a good help to reconstruct what you
> did before a crash, or for writing bug reports (Yes, I know about
> `open-dribble-file', but it's in C).
>
> What is the smartest way to do that (in LISP, of course)?
>
> I could save the buffer content to a file regularly. To have a complete
> log after crashes, I would have to save the buffer after each
> keystroke. This seems very dumb.
>
> There is also `write-region'. But that prints a message in the echo
> area after each call, i.e. in my case, after each hit key.
You can suppress the message:
write-region is an interactive built-in function in `C source code'.
(write-region START END FILENAME &optional APPEND VISIT LOCKNAME MUSTBENEW)
Write current region into specified file.
[...]
If VISIT is neither t nor nil nor a string,
that means do not display the "Wrote file" message.
Steve Berman