* How to suppress messages? @ 2005-01-26 23:25 Drew Adams 2005-01-27 0:33 ` Edward O'Connor 2005-01-27 5:15 ` Eli Zaretskii 0 siblings, 2 replies; 13+ messages in thread From: Drew Adams @ 2005-01-26 23:25 UTC (permalink / raw) 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? 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 ...)). ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to suppress messages? 2005-01-26 23:25 How to suppress messages? Drew Adams @ 2005-01-27 0:33 ` Edward O'Connor 2005-01-27 1:03 ` Drew Adams 2005-01-27 5:15 ` Eli Zaretskii 1 sibling, 1 reply; 13+ messages in thread From: Edward O'Connor @ 2005-01-27 0:33 UTC (permalink / raw) Drew Adams wrote: > 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 ted@oconnor.cx Ense petit placidam sub libertate quietem. ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: How to suppress messages? 2005-01-27 0:33 ` Edward O'Connor @ 2005-01-27 1:03 ` Drew Adams 0 siblings, 0 replies; 13+ messages in thread From: Drew Adams @ 2005-01-27 1:03 UTC (permalink / raw) > 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)) ...) 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. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to suppress messages? 2005-01-26 23:25 How to suppress messages? Drew Adams 2005-01-27 0:33 ` Edward O'Connor @ 2005-01-27 5:15 ` Eli Zaretskii 2005-01-27 17:24 ` Drew Adams 1 sibling, 1 reply; 13+ messages in thread From: Eli Zaretskii @ 2005-01-27 5:15 UTC (permalink / raw) > From: "Drew Adams" <drew.adams@oracle.com> > Date: Wed, 26 Jan 2005 15:25:48 -0800 > > 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. ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: How to suppress messages? 2005-01-27 5:15 ` Eli Zaretskii @ 2005-01-27 17:24 ` Drew Adams 2005-01-27 20:50 ` John Paul Wallington [not found] ` <mailman.15770.1106861744.27204.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 13+ messages in thread From: Drew Adams @ 2005-01-27 17:24 UTC (permalink / raw) > 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. 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to suppress messages? 2005-01-27 17:24 ` Drew Adams @ 2005-01-27 20:50 ` John Paul Wallington 2005-01-27 21:10 ` Drew Adams [not found] ` <mailman.15770.1106861744.27204.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 13+ messages in thread From: John Paul Wallington @ 2005-01-27 20:50 UTC (permalink / raw) Cc: emacs-pretest-bug, help-gnu-emacs > It's too bad that there is no way to inhibit messages, IMO. Not recommended, but how about binding `executing-kbd-macro' to t ? ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: How to suppress messages? 2005-01-27 20:50 ` John Paul Wallington @ 2005-01-27 21:10 ` Drew Adams 2005-01-27 23:18 ` T. V. Raman 0 siblings, 1 reply; 13+ messages in thread From: Drew Adams @ 2005-01-27 21:10 UTC (permalink / raw) Cc: emacs-pretest-bug, help-gnu-emacs > It's too bad that there is no way to inhibit messages, IMO. 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). ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: How to suppress messages? 2005-01-27 21:10 ` Drew Adams @ 2005-01-27 23:18 ` T. V. Raman 0 siblings, 0 replies; 13+ messages in thread From: T. V. Raman @ 2005-01-27 23:18 UTC (permalink / raw) Cc: emacs-pretest-bug, help-gnu-emacs, John Paul Wallington well, if you really really want to suppress messages, you could advice it to be silent. see defadvice. >>>>> "Drew" == Drew Adams <drew.adams@oracle.com> writes: >> 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-pretest-bug@gnu.org Drew> http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug -- Best Regards, --raman Email: raman@users.sf.net WWW: http://emacspeak.sf.net/raman/ AIM: TVRaman PGP: http://emacspeak.sf.net/raman/raman-almaden.asc ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <mailman.15770.1106861744.27204.help-gnu-emacs@gnu.org>]
* Re: How to suppress messages? [not found] ` <mailman.15770.1106861744.27204.help-gnu-emacs@gnu.org> @ 2005-01-27 23:45 ` Thien-Thi Nguyen 0 siblings, 0 replies; 13+ messages in thread From: Thien-Thi Nguyen @ 2005-01-27 23:45 UTC (permalink / raw) John Paul Wallington <jpw@gnu.org>: > 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) ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <mailman.15741.1106847668.27204.help-gnu-emacs@gnu.org>]
* Re: How to suppress messages? [not found] <mailman.15741.1106847668.27204.help-gnu-emacs@gnu.org> @ 2005-01-28 7:43 ` Tom Capey 2005-01-28 8:20 ` Tom Capey 2005-01-28 15:06 ` Drew Adams 0 siblings, 2 replies; 13+ messages in thread From: Tom Capey @ 2005-01-28 7:43 UTC (permalink / raw) * 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to suppress messages? 2005-01-28 7:43 ` Tom Capey @ 2005-01-28 8:20 ` Tom Capey 2005-01-28 15:06 ` Drew Adams 1 sibling, 0 replies; 13+ messages in thread From: Tom Capey @ 2005-01-28 8:20 UTC (permalink / raw) * Tom Capey <tom.capey@edina.co.uk> writes: > You could always use `let' from the cl package: ^^^ `flet' /Tom -- I for one welcome our new key-chord-requiring self-documenting extensible OS-in-an-editor Emacs overlord. -- Jock Cooper ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: How to suppress messages? 2005-01-28 7:43 ` Tom Capey 2005-01-28 8:20 ` Tom Capey @ 2005-01-28 15:06 ` Drew Adams 2005-01-28 18:56 ` Joe Corneli 1 sibling, 1 reply; 13+ messages in thread From: Drew Adams @ 2005-01-28 15:06 UTC (permalink / raw) Right, I should have thought of that. A bit of a sledgehammer here, perhaps, but thanks for reminding me of it. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to suppress messages? 2005-01-28 15:06 ` Drew Adams @ 2005-01-28 18:56 ` Joe Corneli 0 siblings, 0 replies; 13+ messages in thread From: Joe Corneli @ 2005-01-28 18:56 UTC (permalink / raw) This is how I do it, quite heavy duty. (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))) ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2005-01-28 18:56 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-01-26 23:25 How to suppress messages? 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 [not found] <mailman.15741.1106847668.27204.help-gnu-emacs@gnu.org> 2005-01-28 7:43 ` Tom Capey 2005-01-28 8:20 ` Tom Capey 2005-01-28 15:06 ` Drew Adams 2005-01-28 18:56 ` Joe Corneli
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.