[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to automatically write *Messages" buffer to a file?
From: |
Stefan Monnier |
Subject: |
Re: How to automatically write *Messages" buffer to a file? |
Date: |
Wed, 24 Nov 2004 20:55:15 GMT |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
>> (setq after-change-functions nil)
> Never use `setq' on a hook. Use `add-hook' or `remove-hook'.
> I didn't know it was a hook (though I did think to myself that it was
> very hook-like). The variable name is not descriptive. Maybe it
> should be aliased to or renamed `after-change-hook'.
Normal hooks have names that end in `-hook'. Special hooks
(e.g. hooks whose functions take arguments, or whose return value is not
ignored) have names that end in `-functions'. It's all explained in the
elisp manual, of course.
> As for your question, don't use `append-to-file', use `write-region'
> instead, and pass `quiet' as the VISIT argument to prevent the message.
> Shouldn't advice to `write-region' be sufficient?
You can't put "advice" and "sufficient" together like that without adding
a smiley somewhere. `advice' is a sledghammer: it's the last resort before
modifying the source code.
`append-to-file' is only defined so as to make appending possible
interactively. From elisp you should jsut call `write-region' directly.
> `append-to-file' just calls this function. True, using `write-region' is
> more transparent (and I had an error in my advice to this function), but
> I don't see why advising `write-region' and then calling `append-to-file'
> wouldn't work.
Advising is a source of major headaches because of unexpected interactions
with other pieces of code which do not expect write-region to
behave differently. Advice have to be written *extremely* carefully.
I.e. if you can do it without `advice', then don't use `advice'.
Stefan
- How to automatically write *Messages" buffer to a file?, Brad Collins, 2004/11/23
- Re: How to automatically write *Messages" buffer to a file?, Pascal Bourguignon, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Eli Zaretskii, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/24
- Message not available
- Re: How to automatically write *Messages" buffer to a file?, Stefan Monnier, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/24
- Message not available
- Re: How to automatically write *Messages" buffer to a file?,
Stefan Monnier <=
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/24
- RE: How to automatically write *Messages" buffer to a file?, Drew Adams, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/25
- Message not available
- Re: How to automatically write *Messages" buffer to a file?, Stefan Monnier, 2004/11/25
- Message not available
- Re: How to automatically write *Messages" buffer to a file?, Thien-Thi Nguyen, 2004/11/24
- Re: How to automatically write *Messages" buffer to a file?, Joe Corneli, 2004/11/25