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

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

Re: How to automatically write *Messages" buffer to a file?


From: Joe Corneli
Subject: Re: How to automatically write *Messages" buffer to a file?
Date: Wed, 24 Nov 2004 14:28:21 -0600

   >   (make-variable-buffer-local 'after-change-functions)

   Never use `make-variable-buffer-local' on a variable which belongs to some
   other package.  You want to use `make-local-variable' instead.

   Note that in the above case you don't need either of them because
   after-change-functions is already automatically made buffer-local.  And even
   if you wanted to make it buffer-local manually, you shouldn't use
   make-local-variable but make-local-hook since after-change-functions is
   a hook.

   >   (setq after-change-functions
   >          '(log-message))
   [...]
   >   (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'.

   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?  `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.




reply via email to

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