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

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

Re: How to suppress messages?


From: Tom Capey
Subject: Re: How to suppress messages?
Date: Fri, 28 Jan 2005 07:43:35 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3 (windows-nt)

* Drew Adams <address@hidden> writes:

>> I couldn't find any mention in the Elisp manual of a way to
>> do this. If I
>> have a function that calls a function (a built-in, as it
>> turns out) that
>> calls (message...), how can my function stop the message from being
>> displayed by the called function?

>     I don't think there is a way to disable messages in the echo area,
>     except perhaps some clever trick.

>     The usual way to avoid messages is not to call functions that are
>     meant for interactive invocation, but instead use their
>     non-interactive subroutines.

> Of course. However, there may not always be such a choice. As I mentioned,
> this particular occurrence concerns a call to `default-boundp' that (in
> Emacs 20) thinks it needs to display a message. I had a similar problem in
> Emacs 21 with `xw-defined-colors' calling `message' (bug has been filed).
> One can't expect bugs in previous Emacs versions to be corrected, of course.

> It's too bad that there is no way to inhibit messages, IMO.

  You could always use `let' from the cl package:


(require 'cl)

(defun foobar ()
  (message "hello from foobar")
  (sit-for 1)
  (flet ((message (arg)
         nil))
    (message "hello from foobar's flet")
    (sit-for 1)
    (bar))
  (message "goodbye"))

(defun bar ()
  (message "hello from bar")
  (sit-for 1))

(foobar)

  And output in the *Messages* buffer:

hello from foobar
goodbye

  
/Tom
-- 
I for one welcome our new key-chord-requiring self-documenting
extensible OS-in-an-editor Emacs overlord. -- Jock Cooper



reply via email to

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