all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: elisp: how to stop messaging in echo area for save-buffer
Date: Mon, 10 Aug 2009 16:23:25 +0200	[thread overview]
Message-ID: <7c1vnjlpcy.fsf@pbourguignon.anevia.com> (raw)
In-Reply-To: mailman.4210.1249757817.2239.help-gnu-emacs@gnu.org

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__


  parent reply	other threads:[~2009-08-10 14:23 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 [this message]
2009-08-29  0:34         ` Florian Beck
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

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

  git send-email \
    --in-reply-to=7c1vnjlpcy.fsf@pbourguignon.anevia.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.