From: Oleh Krehel <ohwoeowho@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Is there a way to inhibit message3 from Elisp?
Date: Wed, 22 Apr 2015 14:50:49 +0200 [thread overview]
Message-ID: <87bnige386.fsf@gmail.com> (raw)
In-Reply-To: <831tjc4ah3.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Apr 2015 15:24:24 +0300")
Thanks for the comments, Eli. I attach a squashed patch.
Please check again if it's alright.
Oleh
===File
/home/oleh/git/gnu-emacs/0001-Add-a-new-inhibit-message-variable.patch===
From 95015bef323d1cc7c935a676a6526995ea0a3ca9 Mon Sep 17 00:00:00 2001
From: Oleh Krehel <ohwoeowho@gmail.com>
Date: Wed, 22 Apr 2015 14:45:09 +0200
Subject: [PATCH] Add a new `inhibit-message' variable
* src/xdisp.c (syms_of_xdisp): Define a boolean `inhibit_message'.
(message3): Don't call `message3_nolog' (i.e. use the Echo Area) when
`inhibit_message' is non-zero.
* etc/NEWS: Add an entry.
* doc/lispref/display.texi: Add an entry for `inhibit-message',
mention it in `message'.
---
doc/lispref/display.texi | 8 ++++++++
etc/NEWS | 5 +++++
src/xdisp.c | 9 +++++++--
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index e2a38b6..f86149d 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -257,6 +257,9 @@ text properties (@pxref{Logging Messages}).
In batch mode, the message is printed to the standard error stream,
followed by a newline.
+When @code{inhibit-message} is non-nil, no message will be displayed
+in the echo area, it will only be logged to @samp{*Messages*}.
+
If @var{format-string} is @code{nil} or the empty string,
@code{message} clears the echo area; if the echo area has been
expanded automatically, this brings it back to its normal size. If
@@ -282,6 +285,11 @@ To automatically display a message in the echo area or in a pop-buffer,
depending on its size, use @code{display-message-or-buffer} (see below).
@end defun
+@defvar inhibit-message
+When this variable is non-nil, @code{message} and related functions
+will not use the Echo Area to display messages.
+@end defvar
+
@defmac with-temp-message message &rest body
This construct displays a message in the echo area temporarily, during
the execution of @var{body}. It displays @var{message}, executes
diff --git a/etc/NEWS b/etc/NEWS
index 804b819..e2b6b11 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -200,6 +200,11 @@ font, and (iii) the specified window.
** New possible value for `system-type': nacl.
++++
+** New variable `inhibit-message', when bound to non-nil, inhibits
+ `message' and related functions from displaying messages the Echo
+ Area. The output is still logged to the *Messages* buffer.
+
\f
* Editing Changes in Emacs 25.1
diff --git a/src/xdisp.c b/src/xdisp.c
index a17f5a9..6ca1906 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10053,8 +10053,8 @@ message3 (Lisp_Object m)
message_dolog (buffer, nbytes, true, multibyte);
SAFE_FREE ();
}
- message3_nolog (m);
-
+ if (! inhibit_message)
+ message3_nolog (m);
UNGCPRO;
}
@@ -30430,6 +30430,11 @@ syms_of_xdisp (void)
DEFSYM (Qredisplay_internal, "redisplay_internal (C function)");
+ DEFVAR_BOOL("inhibit-message", inhibit_message,
+ doc: /* Non-nil means calls to `message' are not displayed.
+They are still logged to the *Messages* buffer. */);
+ inhibit_message = 0;
+
message_dolog_marker1 = Fmake_marker ();
staticpro (&message_dolog_marker1);
message_dolog_marker2 = Fmake_marker ();
--
1.8.4
============================================================
next prev parent reply other threads:[~2015-04-22 12:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 13:37 Is there a way to inhibit message3 from Elisp? Oleh Krehel
2015-04-21 17:17 ` Stefan Monnier
2015-04-21 18:50 ` Oleh Krehel
2015-04-21 23:25 ` Artur Malabarba
2015-04-22 6:00 ` Oleh Krehel
2015-04-22 10:53 ` Eli Zaretskii
2015-04-22 11:55 ` Oleh Krehel
2015-04-22 12:24 ` Eli Zaretskii
2015-04-22 12:50 ` Oleh Krehel [this message]
2015-04-22 13:01 ` Eli Zaretskii
2015-04-22 13:51 ` Stefan Monnier
2015-04-22 13:48 ` Oleh Krehel
2015-04-22 17:39 ` Artur Malabarba
2015-04-22 20:20 ` Stefan Monnier
2015-04-22 12:42 ` Artur Malabarba
2015-04-22 17:22 ` Artur Malabarba
2015-04-22 17:20 ` Oleh Krehel
2015-04-22 13:53 ` Stefan Monnier
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=87bnige386.fsf@gmail.com \
--to=ohwoeowho@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.