aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-11-27 01:43:49 +0200
committerJuri Linkov2019-11-27 01:43:49 +0200
commitaa89c84e00d8dc85100e6fedab7631c415e6364d (patch)
tree5e81616e1b5f2ee5ca232a10acf63fc62a6997f8
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.
-rw-r--r--doc/lispref/display.texi8
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/autorevert.el3
-rw-r--r--lisp/isearch.el4
-rw-r--r--lisp/man.el2
-rw-r--r--lisp/minibuffer.el12
-rw-r--r--lisp/subr.el2
-rw-r--r--src/editfns.c56
8 files changed, 76 insertions, 15 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index ddbae40ac90..1f7cc93c9c4 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -276,11 +276,13 @@ followed by a newline.
276When @code{inhibit-message} is non-@code{nil}, no message will be displayed 276When @code{inhibit-message} is non-@code{nil}, no message will be displayed
277in the echo area, it will only be logged to @samp{*Messages*}. 277in the echo area, it will only be logged to @samp{*Messages*}.
278 278
279If the minibuffer is active, it uses the @code{minibuffer-message}
280function to display the message temporarily at the end of the
281minibuffer (@pxref{Minibuffer Misc}).
282
279If @var{format-string} is @code{nil} or the empty string, 283If @var{format-string} is @code{nil} or the empty string,
280@code{message} clears the echo area; if the echo area has been 284@code{message} clears the echo area; if the echo area has been
281expanded automatically, this brings it back to its normal size. If 285expanded automatically, this brings it back to its normal size.
282the minibuffer is active, this brings the minibuffer contents back
283onto the screen immediately.
284 286
285@example 287@example
286@group 288@group
diff --git a/etc/NEWS b/etc/NEWS
index 662156d684d..eb32d70f571 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -755,6 +755,10 @@ the minibuffer. If non-nil, point will move to the end of the prompt
755at the end of the active minibuffer. 755at the end of the active minibuffer.
756 756
757+++ 757+++
758*** The function 'message' now displays the message at the end of the minibuffer
759when the minibuffer is active.
760
761+++
758*** 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer. 762*** 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer.
759 763
760*** Some commands that previously used read-char-choice now read 764*** Some commands that previously used read-char-choice now read
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 079750a3f6a..9275513c8d2 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -815,8 +815,7 @@ This is an internal function used by Auto-Revert Mode."
815 (when revert 815 (when revert
816 (when (and auto-revert-verbose 816 (when (and auto-revert-verbose
817 (not (eq revert 'fast))) 817 (not (eq revert 'fast)))
818 (with-current-buffer (window-buffer (old-selected-window)) 818 (message "Reverting buffer `%s'." (buffer-name)))
819 (minibuffer-message "Reverting buffer `%s'." (buffer-name))))
820 ;; If point (or a window point) is at the end of the buffer, we 819 ;; If point (or a window point) is at the end of the buffer, we
821 ;; want to keep it at the end after reverting. This allows one 820 ;; want to keep it at the end after reverting. This allows one
822 ;; to tail a file. 821 ;; to tail a file.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 4f3342782d3..7c22e6ad971 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2011,7 +2011,7 @@ Turning on character-folding turns off regexp mode.")
2011(defun isearch--momentary-message (string) 2011(defun isearch--momentary-message (string)
2012 "Print STRING at the end of the isearch prompt for 1 second." 2012 "Print STRING at the end of the isearch prompt for 1 second."
2013 (let ((message-log-max nil)) 2013 (let ((message-log-max nil))
2014 (message "%s%s%s" 2014 (message-in-echo-area "%s%s%s"
2015 (isearch-message-prefix nil isearch-nonincremental) 2015 (isearch-message-prefix nil isearch-nonincremental)
2016 isearch-message 2016 isearch-message
2017 (apply #'propertize (format " [%s]" string) 2017 (apply #'propertize (format " [%s]" string)
@@ -3168,7 +3168,7 @@ If there is no completion possible, say so and continue searching."
3168 (isearch-message-prefix ellipsis isearch-nonincremental) 3168 (isearch-message-prefix ellipsis isearch-nonincremental)
3169 m 3169 m
3170 (isearch-message-suffix c-q-hack))) 3170 (isearch-message-suffix c-q-hack)))
3171 (if c-q-hack m (let ((message-log-max nil)) (message "%s" m))))) 3171 (if c-q-hack m (let ((message-log-max nil)) (message-in-echo-area "%s" m)))))
3172 3172
3173(defun isearch--describe-regexp-mode (regexp-function &optional space-before) 3173(defun isearch--describe-regexp-mode (regexp-function &optional space-before)
3174 "Make a string for describing REGEXP-FUNCTION. 3174 "Make a string for describing REGEXP-FUNCTION.
diff --git a/lisp/man.el b/lisp/man.el
index ce01fdc8056..beec2e616f5 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1474,7 +1474,7 @@ manpage command."
1474 (kill-buffer Man-buffer))) 1474 (kill-buffer Man-buffer)))
1475 1475
1476 (when message 1476 (when message
1477 (minibuffer-message "%s" message))))) 1477 (message "%s" message)))))
1478 1478
1479(defun Man-page-from-arguments (args) 1479(defun Man-page-from-arguments (args)
1480 ;; Skip arguments and only print the page name. 1480 ;; Skip arguments and only print the page name.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index b9e5d5a3a27..a7bdde478fd 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -712,16 +712,16 @@ If ARGS are provided, then pass MESSAGE through `format-message'."
712 (progn 712 (progn
713 (if args 713 (if args
714 (apply #'message message args) 714 (apply #'message message args)
715 (message "%s" message)) 715 (message-in-echo-area "%s" message))
716 (prog1 (sit-for (or minibuffer-message-timeout 1000000)) 716 (prog1 (sit-for (or minibuffer-message-timeout 1000000))
717 (message nil))) 717 (message-in-echo-area nil)))
718 ;; Record message in the *Messages* buffer 718 ;; Record message in the *Messages* buffer
719 (let ((inhibit-message t)) 719 (let ((inhibit-message t))
720 (if args 720 (if args
721 (apply #'message message args) 721 (apply #'message message args)
722 (message "%s" message))) 722 (message-in-echo-area "%s" message)))
723 ;; Clear out any old echo-area message to make way for our new thing. 723 ;; Clear out any old echo-area message to make way for our new thing.
724 (message nil) 724 (message-in-echo-area nil)
725 (setq message (if (and (null args) 725 (setq message (if (and (null args)
726 (string-match-p "\\` *\\[.+\\]\\'" message)) 726 (string-match-p "\\` *\\[.+\\]\\'" message))
727 ;; Make sure we can put-text-property. 727 ;; Make sure we can put-text-property.
@@ -1840,7 +1840,7 @@ variables.")
1840(defun minibuffer-completion-help (&optional start end) 1840(defun minibuffer-completion-help (&optional start end)
1841 "Display a list of possible completions of the current minibuffer contents." 1841 "Display a list of possible completions of the current minibuffer contents."
1842 (interactive) 1842 (interactive)
1843 (message "Making completion list...") 1843 (message-in-echo-area "Making completion list...")
1844 (let* ((start (or start (minibuffer-prompt-end))) 1844 (let* ((start (or start (minibuffer-prompt-end)))
1845 (end (or end (point-max))) 1845 (end (or end (point-max)))
1846 (string (buffer-substring start end)) 1846 (string (buffer-substring start end))
@@ -1851,7 +1851,7 @@ variables.")
1851 minibuffer-completion-predicate 1851 minibuffer-completion-predicate
1852 (- (point) start) 1852 (- (point) start)
1853 md))) 1853 md)))
1854 (message nil) 1854 (message-in-echo-area nil)
1855 (if (or (null completions) 1855 (if (or (null completions)
1856 (and (not (consp (cdr completions))) 1856 (and (not (consp (cdr completions)))
1857 (equal (car completions) string))) 1857 (equal (car completions) string)))
diff --git a/lisp/subr.el b/lisp/subr.el
index 01f4f531b14..7e8c4fc23cb 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4607,7 +4607,7 @@ This function is called directly from the C code."
4607 (string-match "\\.elc?\\>" file)) 4607 (string-match "\\.elc?\\>" file))
4608 obarray)) 4608 obarray))
4609 (msg (format "Package %s is deprecated" package)) 4609 (msg (format "Package %s is deprecated" package))
4610 (fun (lambda (msg) (minibuffer-message "%s" msg)))) 4610 (fun (lambda (msg) (message "%s" msg))))
4611 ;; Cribbed from cl--compiling-file. 4611 ;; Cribbed from cl--compiling-file.
4612 (when (or (not (fboundp 'byte-compile-warning-enabled-p)) 4612 (when (or (not (fboundp 'byte-compile-warning-enabled-p))
4613 (byte-compile-warning-enabled-p 'obsolete package)) 4613 (byte-compile-warning-enabled-p 'obsolete package))
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);