From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joe Corneli Newsgroups: gmane.emacs.help Subject: Re: How to automatically write *Messages" buffer to a file? Date: Wed, 24 Nov 2004 14:28:21 -0600 Message-ID: References: <87sm6zl4sx.fsf@thalassa.informatimago.com> <01c4d23d$Blat.v2.2.2$c2b81b20@zahav.net.il> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1101328181 31170 80.91.229.6 (24 Nov 2004 20:29:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 Nov 2004 20:29:41 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 24 21:29:29 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CX3lZ-000750-00 for ; Wed, 24 Nov 2004 21:29:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CX3ui-0006dd-Gr for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Nov 2004 15:38:56 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CX3uZ-0006dW-6p for help-gnu-emacs@gnu.org; Wed, 24 Nov 2004 15:38:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CX3uY-0006dK-Pa for help-gnu-emacs@gnu.org; Wed, 24 Nov 2004 15:38:46 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CX3uY-0006dH-NA for help-gnu-emacs@gnu.org; Wed, 24 Nov 2004 15:38:46 -0500 Original-Received: from [146.6.139.124] (helo=dell3.ma.utexas.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CX3kU-0003xG-Lo for help-gnu-emacs@gnu.org; Wed, 24 Nov 2004 15:28:22 -0500 Original-Received: from linux183.ma.utexas.edu (mail@linux183.ma.utexas.edu [146.6.139.172]) by dell3.ma.utexas.edu (8.11.0.Beta3/8.10.2) with ESMTP id iAOKSM801594; Wed, 24 Nov 2004 14:28:22 -0600 Original-Received: from jcorneli by linux183.ma.utexas.edu with local (Exim 3.36 #1 (Debian)) id 1CX3kT-0004gj-00; Wed, 24 Nov 2004 14:28:21 -0600 Original-To: help-gnu-emacs@gnu.org In-reply-to: (message from Stefan Monnier on Wed, 24 Nov 2004 20:16:30 GMT) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:22283 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:22283 > (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.