The example is a call to `default-boundp'. In Emacs 20, this apparently
displays a message "Library is file `whatever'." By grepping, this seems
like it might come from a call to `locate-library', but, as I say,
`default-boundp' is built-in.
Is there some way to bind something and then call the "messaging" function
(e.g. `default-boundp') from within the binding scope, to prevent messages
from echoing? E.g. (let ((inhibit-messages t)) ... (default-boundp ...)).
> 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?
(let ((message-log-max nil))
...)
HTH.
Ted
--
Edward O'Connor
t...@oconnor.cx
Ense petit placidam sub libertate quietem.
(let ((message-log-max nil))
...)
Thanks, but that doesn't do it. It just stops logging to buffer *Messages*.
I want to stop messages from appearing in the echo area.
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.
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.
CCing the bug list, as I would like to consider this an enhancement request:
Provide some way to inhibit messages to the echo area, similarly to what
`message-log-max' = nil does for logging messages to *Messages*.
- Drew
Not recommended, but how about binding `executing-kbd-macro' to t ?
Oddly enough, that doesn't seem to do the trick in this case. If I comment
out the call to `default-boundp', then the messages stop appearing, but if I
put the call inside (let ((executing-kbd-macro t))...), the messages still
appear (in Emacs 20).
>> It's too bad that there is no way to inhibit messages, IMO.
Drew> Not recommended, but how about binding
Drew> `executing-kbd-macro' to t ?
Drew> Oddly enough, that doesn't seem to do the trick in this
Drew> case. If I comment out the call to `default-boundp', then
Drew> the messages stop appearing, but if I put the call inside
Drew> (let ((executing-kbd-macro t))...), the messages still
Drew> appear (in Emacs 20).
Drew> _______________________________________________
Drew> Emacs-pretest-bug mailing list Emacs-pr...@gnu.org
Drew> http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
--
Best Regards,
--raman
Email: ra...@users.sf.net
WWW: http://emacspeak.sf.net/raman/
AIM: TVRaman
PGP: http://emacspeak.sf.net/raman/raman-almaden.asc
> Not recommended [...]
while we're unrecommending things, below is some more unrecommended
(five-minute sketch, incomplete, not exactly pretty result) stuff...
thi
____________________________________
cvs diff editfns.c xdisp.c
Index: editfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/editfns.c,v
retrieving revision 1.389
diff -w -b -B -u -r1.389 editfns.c
--- editfns.c 21 Jan 2005 00:32:36 -0000 1.389
+++ editfns.c 27 Jan 2005 23:38:58 -0000
@@ -3114,6 +3114,8 @@
/* Allocated length of that buffer. */
static int message_length;
+Lisp_Object Vmessage_stfu_dammit;
+
DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,
doc: /* Print a one-line message at the bottom of the screen.
The message also goes into the `*Messages*' buffer.
@@ -3125,11 +3127,16 @@
If the first argument is nil, the function clears any existing message;
this lets the minibuffer contents show. See also `current-message'.
+TTN curmudgeon hack: Non-nil `message-stfu-dammit' inhibits everything.
+
usage: (message STRING &rest ARGS) */)
(nargs, args)
int nargs;
Lisp_Object *args;
{
+ if (! NILP (Vmessage_stfu_dammit))
+ return Qnil;
+
if (NILP (args[0])
|| (STRINGP (args[0])
&& SBYTES (args[0]) == 0))
@@ -4271,6 +4278,10 @@
{
environbuf = 0;
+ DEFVAR_LISP ("message-stfu-dammit", &Vmessage_stfu_dammit,
+ doc: /* Non-nil makes `message' a no-op. */);
+ Vmessage_stfu_dammit = Qnil;
+
Qbuffer_access_fontify_functions
= intern ("buffer-access-fontify-functions");
staticpro (&Qbuffer_access_fontify_functions);
Index: xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.974
diff -w -b -B -u -r1.974 xdisp.c
--- xdisp.c 27 Jan 2005 22:33:52 -0000 1.974
+++ xdisp.c 27 Jan 2005 23:39:04 -0000
@@ -7045,6 +7045,14 @@
char *m;
EMACS_INT a1, a2, a3;
{
+ /* TTN curmudgeon hack (same as for `Fmessage'):
+ Non-nil `message-stfu-dammit' inhibits everything. */
+ extern Lisp_Object Vmessage_stfu_dammit;
+
+ if (! NILP (Vmessage_stfu_dammit))
+ return;
+ /* We now return you to your regularly spewful Emacs... */
+
if (noninteractive)
{
if (m)
>> 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
> You could always use `let' from the cl package:
^^^
`flet'
(defvar messaging-on nil
"Control whether or not messages will be printed; by default,
they are not.")
;; Note that by itself this renders edebug pretty useless.
(defadvice message (around nomessage activate)
"Turn off messaging most of the time.
Whether or not messages are displayed is determined by the value
of the variable `messaging-on'."
(when messaging-on
ad-do-it))
;; This is what is needed to make edebug work even
;; when the `nomessage' advice is in effect.
(defadvice edebug-previous-result (around override-nomessage activate)
"Make edebug work when messaging is turned off by default."
(let ((messaging-on t))
ad-do-it))
(defadvice write-region (around no-wrote-file activate)
"Turn off the printout associated with writing files.
This is necessary to add as a supplement to `nomessage' because
the \"Wrote file\" message is not printed through the `message'
mechanism. The observed effect of this piece of advice is that
neither `save-buffer' nor `write-file' will print anything out
when they run."
(if messaging-on
ad-do-it
(set-buffer-modified-p nil)
(ad-set-arg 4 1)
(ad-set-arg 6 nil)
ad-do-it))
(defun turn-messaging-off ()
(interactive)
(ad-enable-advice 'message 'around 'nomessage)
(ad-activate 'message)
(ad-enable-advice 'write-region 'around 'no-wrote-file)
(ad-activate 'write-region))
(defun turn-messaging-on ()
(interactive)
(ad-disable-advice 'message 'around 'nomessage)
(ad-activate 'message)
(ad-disable-advice 'write-region 'around 'no-wrote-file)
(ad-activate 'write-region))
(defun my-message (str)
"Send a message, overriding our usual advice."
(let ((messaging-on t))
(message str)))