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 suppress messages? Date: Fri, 28 Jan 2005 12:56:39 -0600 Message-ID: References: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1106938708 4015 80.91.229.6 (28 Jan 2005 18:58:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 Jan 2005 18:58:28 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 28 19:58:16 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CubJw-0003Sy-00 for ; Fri, 28 Jan 2005 19:58:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CubWM-0007X2-NV for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Jan 2005 14:11:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CubV9-0006bT-Mp for help-gnu-emacs@gnu.org; Fri, 28 Jan 2005 14:09:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CubV1-0006Xc-T3 for help-gnu-emacs@gnu.org; Fri, 28 Jan 2005 14:09:46 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CubV0-0006XE-8y for help-gnu-emacs@gnu.org; Fri, 28 Jan 2005 14:09:42 -0500 Original-Received: from [146.6.139.124] (helo=dell3.ma.utexas.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CubIP-0006L9-Is for help-gnu-emacs@gnu.org; Fri, 28 Jan 2005 13:56:42 -0500 Original-Received: from lab45.ma.utexas.edu (mail@lab45.ma.utexas.edu [128.83.133.159]) by dell3.ma.utexas.edu (8.11.0.Beta3/8.10.2) with ESMTP id j0SIudl24127; Fri, 28 Jan 2005 12:56:39 -0600 Original-Received: from jcorneli by lab45.ma.utexas.edu with local (Exim 3.36 #1 (Debian)) id 1CubIN-0008Vo-00; Fri, 28 Jan 2005 12:56:39 -0600 Original-To: help-gnu-emacs@gnu.org In-reply-to: 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:23729 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:23729 This is how I do it, quite heavy duty. (defvar messaging-on nil "Control whether or not messages will be printed; by default, they are not.") ;; Note that by itself this renders edebug pretty useless. (defadvice message (around nomessage activate) "Turn off messaging most of the time. Whether or not messages are displayed is determined by the value of the variable `messaging-on'." (when messaging-on ad-do-it)) ;; This is what is needed to make edebug work even ;; when the `nomessage' advice is in effect. (defadvice edebug-previous-result (around override-nomessage activate) "Make edebug work when messaging is turned off by default." (let ((messaging-on t)) ad-do-it)) (defadvice write-region (around no-wrote-file activate) "Turn off the printout associated with writing files. This is necessary to add as a supplement to `nomessage' because the \"Wrote file\" message is not printed through the `message' mechanism. The observed effect of this piece of advice is that neither `save-buffer' nor `write-file' will print anything out when they run." (if messaging-on ad-do-it (set-buffer-modified-p nil) (ad-set-arg 4 1) (ad-set-arg 6 nil) ad-do-it)) (defun turn-messaging-off () (interactive) (ad-enable-advice 'message 'around 'nomessage) (ad-activate 'message) (ad-enable-advice 'write-region 'around 'no-wrote-file) (ad-activate 'write-region)) (defun turn-messaging-on () (interactive) (ad-disable-advice 'message 'around 'nomessage) (ad-activate 'message) (ad-disable-advice 'write-region 'around 'no-wrote-file) (ad-activate 'write-region)) (defun my-message (str) "Send a message, overriding our usual advice." (let ((messaging-on t)) (message str)))