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

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

Re: elisp: how to stop messaging in echo area for save-buffer


From: Pascal J. Bourguignon
Subject: Re: elisp: how to stop messaging in echo area for save-buffer
Date: Mon, 10 Aug 2009 16:23:25 +0200
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux)

Florian Beck <abstraktion@t-online.de> writes:

> Xah Lee <xahlee@gmail.com> 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.  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#))))



-- 
__Pascal Bourguignon__


reply via email to

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