From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Florian Beck Newsgroups: gmane.emacs.help Subject: Re: elisp: how to stop messaging in echo area for save-buffer Date: Sat, 29 Aug 2009 02:34:59 +0200 Message-ID: <87vdk7cv9o.fsf@sophokles.streitblatt.de> References: <32bb089d-1505-42de-bedd-5ad3dbf16a19@f33g2000vbm.googlegroups.com> <7c1vnjlpcy.fsf@pbourguignon.anevia.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251506167 17423 80.91.229.12 (29 Aug 2009 00:36:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Aug 2009 00:36:07 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: pjb@informatimago.com (Pascal J. Bourguignon) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 29 02:36:00 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MhBvE-0004HC-EL for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Aug 2009 02:36:00 +0200 Original-Received: from localhost ([127.0.0.1]:55226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhBvD-0002If-S6 for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Aug 2009 20:35:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhBur-0002FH-HR for help-gnu-emacs@gnu.org; Fri, 28 Aug 2009 20:35:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhBum-00027k-TN for help-gnu-emacs@gnu.org; Fri, 28 Aug 2009 20:35:36 -0400 Original-Received: from [199.232.76.173] (port=51766 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhBum-00027b-P5 for help-gnu-emacs@gnu.org; Fri, 28 Aug 2009 20:35:32 -0400 Original-Received: from mo-p05-ob.rzone.de ([81.169.146.181]:18084) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1MhBum-0003b5-DM for help-gnu-emacs@gnu.org; Fri, 28 Aug 2009 20:35:32 -0400 X-RZG-AUTH: :KmALZ0mpdbGonPxw7gDkop508XQjelhLxGYn4B74/iddlkME3ssvHN/NVn+dtQ6oeNmRD72T/ePg X-RZG-CLASS-ID: mo05 Original-Received: from flo-laptop (p54997A8E.dip.t-dialin.net [84.153.122.142]) by post.strato.de (mrclete mo59) (RZmta 21.0) with ESMTP id g025f1l7SNfejf ; Sat, 29 Aug 2009 02:35:01 +0200 (MEST) In-Reply-To: <7c1vnjlpcy.fsf@pbourguignon.anevia.com> (Pascal J. Bourguignon's message of "Mon, 10 Aug 2009 16:23:25 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) 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: news.gmane.org gmane.emacs.help:67629 Archived-At: pjb@informatimago.com (Pascal J. Bourguignon) writes: > Florian Beck writes: > >> Xah Lee writes: >> >> >>>> > i have a elisp script that does a few hundred saving files. Each time >>>> >>>> > (save-buffer) >>>> >>>> > is called, the *Message* buffer contains 2 lines like this: >>> >>> am looking for a way to temp disable save-buffer writing a message to >>> *Message*. Thanks. >> >> Redfine the save-buffer function. >> >> Or temporarily change `message': >> >> (flet ((message (lambda (&rest args)))) >> ... >> (save-buffer) >> ...) >> >> Use at your own risk. > > Indeed. This works because of a bug in flet. Since it's > inspiration is Common Lisp FLET, it should make only a lexical > binding. An inspiration is not a specification. In fact, from aber user's perspective, I think the above is about the strongest argument one can make for elisp's dynamic binding. This is strictly from the point of view of someone who want to customize his emacs. > The version I have has corrected this bug: > > (macroexpand '(flet ((message (&rest args))) (f) (message "done"))) > --> > (let* ((--cl-letf-bound-- (fboundp #1=(quote message))) > (--cl-letf-save-- (and --cl-letf-bound-- (symbol-function #1#)))) > (unwind-protect > (progn > (fset #1# (function* (lambda (&rest args) (block message)))) > (f) > (message "done")) > (if --cl-letf-bound-- > (fset #1# --cl-letf-save--) > (fmakunbound #1#)))) -- Florian Beck