aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorJuri Linkov2019-11-27 01:43:49 +0200
committerJuri Linkov2019-11-27 01:43:49 +0200
commitaa89c84e00d8dc85100e6fedab7631c415e6364d (patch)
tree5e81616e1b5f2ee5ca232a10acf63fc62a6997f8 /src/editfns.c
parentb3c0fb21bd910f5d86490154451cc324ce9ad66b (diff)
downloademacs-aa89c84e00d8dc85100e6fedab7631c415e6364d.tar.gz
emacs-aa89c84e00d8dc85100e6fedab7631c415e6364d.zip
message uses minibuffer-message in the active minibuffer (bug#17272 bug#19064)
* doc/lispref/display.texi (Displaying Messages): Explain the behavior of using minibuffer-message if the minibuffer is active. * src/editfns.c (Fmessage_in_echo_area): New function with body copied from Fmessage. (Fmessage): Call minibuffer-message in the active minibuffer, otherwise call Fmessage_in_echo_area. (message-in-echo-area): New variable. * lisp/isearch.el (isearch--momentary-message, isearch-message): * lisp/minibuffer.el (minibuffer-message, minibuffer-completion-help): Use 'message-in-echo-area' instead of 'message' where necessary. * lisp/autorevert.el (auto-revert-handler): * lisp/man.el (Man-bgproc-sentinel): * lisp/subr.el (do-after-load-evaluation): Revert recent changes that replaced 'message' with 'minibuffer-message'. This is not needed anymore since 'message' uses 'minibuffer-message' in the active minibuffer.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 8fc866d391f..72a9cdba7af 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2875,9 +2875,59 @@ If the first argument is nil or the empty string, the function clears
2875any existing message; this lets the minibuffer contents show. See 2875any existing message; this lets the minibuffer contents show. See
2876also `current-message'. 2876also `current-message'.
2877 2877
2878When the variable `message-in-echo-area' is non-nil, use the function
2879`message-in-echo-area' to display the message in the echo area.
2880Otherwise, when the minibuffer is active, use `minibuffer-message'
2881to temporarily display the message at the end of the minibuffer.
2882
2878usage: (message FORMAT-STRING &rest ARGS) */) 2883usage: (message FORMAT-STRING &rest ARGS) */)
2879 (ptrdiff_t nargs, Lisp_Object *args) 2884 (ptrdiff_t nargs, Lisp_Object *args)
2880{ 2885{
2886 if (NILP (Vmessage_in_echo_area)
2887 && !inhibit_message
2888 && !(NILP (args[0]) || (STRINGP (args[0]) && SBYTES (args[0]) == 0))
2889 && WINDOW_LIVE_P (Factive_minibuffer_window ())
2890 && WINDOW_LIVE_P (Fold_selected_window ())
2891 && BUFFERP (Fwindow_buffer (Fold_selected_window ()))
2892 && !NILP (Fminibufferp (Fwindow_buffer (Fold_selected_window ()))))
2893 {
2894 ptrdiff_t count = SPECPDL_INDEX ();
2895
2896 /* Avoid possible recursion. */
2897 specbind (Qmessage_in_echo_area, Qt);
2898
2899 record_unwind_current_buffer ();
2900 Fset_buffer (Fwindow_buffer (Fold_selected_window ()));
2901
2902 return unbind_to (count, CALLN (Fapply, intern ("minibuffer-message"),
2903 Flist (nargs, args)));
2904 }
2905 else
2906 return Fmessage_in_echo_area (nargs, args);
2907}
2908
2909DEFUN ("message-in-echo-area", Fmessage_in_echo_area, Smessage_in_echo_area, 1, MANY, 0,
2910 doc: /* Display a message at the bottom of the screen.
2911The message also goes into the `*Messages*' buffer, if `message-log-max'
2912is non-nil. (In keyboard macros, that's all it does.)
2913Return the message.
2914
2915In batch mode, the message is printed to the standard error stream,
2916followed by a newline.
2917
2918The first argument is a format control string, and the rest are data
2919to be formatted under control of the string. Percent sign (%), grave
2920accent (\\=`) and apostrophe (\\=') are special in the format; see
2921`format-message' for details. To display STRING without special
2922treatment, use (message-in-echo-area "%s" STRING).
2923
2924If the first argument is nil or the empty string, the function clears
2925any existing message; this lets the minibuffer contents show. See
2926also `current-message'.
2927
2928usage: (message-in-echo-area FORMAT-STRING &rest ARGS) */)
2929 (ptrdiff_t nargs, Lisp_Object *args)
2930{
2881 if (NILP (args[0]) 2931 if (NILP (args[0])
2882 || (STRINGP (args[0]) 2932 || (STRINGP (args[0])
2883 && SBYTES (args[0]) == 0)) 2933 && SBYTES (args[0]) == 0))
@@ -4520,6 +4570,11 @@ This variable is experimental; email 32252@debbugs.gnu.org if you need
4520it to be non-nil. */); 4570it to be non-nil. */);
4521 binary_as_unsigned = false; 4571 binary_as_unsigned = false;
4522 4572
4573 DEFVAR_LISP ("message-in-echo-area", Vmessage_in_echo_area,
4574 doc: /* Non-nil means overwrite the minibuffer with a message in the echo area. */);
4575 Vmessage_in_echo_area = Qnil;
4576 DEFSYM (Qmessage_in_echo_area, "message-in-echo-area");
4577
4523 defsubr (&Spropertize); 4578 defsubr (&Spropertize);
4524 defsubr (&Schar_equal); 4579 defsubr (&Schar_equal);
4525 defsubr (&Sgoto_char); 4580 defsubr (&Sgoto_char);
@@ -4594,6 +4649,7 @@ it to be non-nil. */);
4594 defsubr (&Semacs_pid); 4649 defsubr (&Semacs_pid);
4595 defsubr (&Ssystem_name); 4650 defsubr (&Ssystem_name);
4596 defsubr (&Smessage); 4651 defsubr (&Smessage);
4652 defsubr (&Smessage_in_echo_area);
4597 defsubr (&Smessage_box); 4653 defsubr (&Smessage_box);
4598 defsubr (&Smessage_or_box); 4654 defsubr (&Smessage_or_box);
4599 defsubr (&Scurrent_message); 4655 defsubr (&Scurrent_message);