all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tom Capey <tom.capey@edina.co.uk>
Subject: Re: How to suppress messages?
Date: Fri, 28 Jan 2005 07:43:35 +0000	[thread overview]
Message-ID: <uoefauhg8.fsf@edina.co.uk> (raw)
In-Reply-To: mailman.15741.1106847668.27204.help-gnu-emacs@gnu.org

* Drew Adams <drew.adams@oracle.com> 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	other threads:[~2005-01-28  7:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.15741.1106847668.27204.help-gnu-emacs@gnu.org>
2005-01-28  7:43 ` Tom Capey [this message]
2005-01-28  8:20   ` How to suppress messages? Tom Capey
2005-01-28 15:06   ` Drew Adams
2005-01-28 18:56     ` Joe Corneli
2005-01-26 23:25 Drew Adams
2005-01-27  0:33 ` Edward O'Connor
2005-01-27  1:03   ` Drew Adams
2005-01-27  5:15 ` Eli Zaretskii
2005-01-27 17:24   ` Drew Adams
2005-01-27 20:50     ` John Paul Wallington
2005-01-27 21:10       ` Drew Adams
2005-01-27 23:18         ` T. V. Raman
     [not found]     ` <mailman.15770.1106861744.27204.help-gnu-emacs@gnu.org>
2005-01-27 23:45       ` Thien-Thi Nguyen

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=uoefauhg8.fsf@edina.co.uk \
    --to=tom.capey@edina.co.uk \
    /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.