unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Florian Beck <abstraktion@t-online.de>
To: pjb@informatimago.com (Pascal J. Bourguignon)
Cc: help-gnu-emacs@gnu.org
Subject: Re: elisp: how to stop messaging in echo area for save-buffer
Date: Sat, 29 Aug 2009 02:34:59 +0200	[thread overview]
Message-ID: <87vdk7cv9o.fsf@sophokles.streitblatt.de> (raw)
In-Reply-To: <7c1vnjlpcy.fsf@pbourguignon.anevia.com> (Pascal J. Bourguignon's message of "Mon, 10 Aug 2009 16:23:25 +0200")

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	other threads:[~2009-08-29  0:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-08 15:15 elisp: how to stop messaging in echo area for save-buffer Xah Lee
2009-08-08 16:54 ` A.Politz
2009-08-08 17:01   ` Xah Lee
2009-08-08 18:56     ` Florian Beck
     [not found]     ` <mailman.4210.1249757817.2239.help-gnu-emacs@gnu.org>
2009-08-10 14:23       ` Pascal J. Bourguignon
2009-08-29  0:34         ` Florian Beck [this message]
2009-08-08 17:35 ` Eli Zaretskii
     [not found] ` <mailman.4203.1249752968.2239.help-gnu-emacs@gnu.org>
2009-08-10  8:35   ` Xah Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vdk7cv9o.fsf@sophokles.streitblatt.de \
    --to=abstraktion@t-online.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pjb@informatimago.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).