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: Florian Beck
Subject: Re: elisp: how to stop messaging in echo area for save-buffer
Date: Sat, 29 Aug 2009 02:34:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

pjb@informatimago.com (Pascal J. Bourguignon) writes:

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

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




reply via email to

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