changeset 1703:f561c3904bb3

[xemacs-hg @ 2003-09-20 01:46:53 by youngs] 2003-09-20 Ilya N. Golubev <gin@mo.msk.ru> * simple.el (raw-append-message): Allow user to specify alternative function for displaying message. (redisplay-echo-area-function): New. (clear-message): Allow user to specify function for finishing message display. (undisplay-echo-area-function): New. 2003-09-20 Ilya N. Golubev <gin@mo.msk.ru> * xemacs/mini.texi (Minibuffer): Add customizing message display reference. * lispref/display.texi (Customizing Message Display): New, describe `redisplay-echo-area-function', `undisplay-echo-area-function', `minibuffer-echo-wait-function'. (The Echo Area): Add menu. 2003-09-20 Ilya N. Golubev <gin@mo.msk.ru> * cmdloop.c (Fcommand_loop_1): Allow specifying elisp function for waiting user input while displaying message while in minibuffer. (Vminibuffer_echo_wait_function): New, associated variable... (vars_of_cmdloop): ... initialize it.
author youngs
date Sat, 20 Sep 2003 01:47:03 +0000
parents 245980c04067
children fcaba5100138
files lisp/ChangeLog lisp/simple.el man/ChangeLog man/lispref/display.texi man/xemacs/mini.texi src/ChangeLog src/cmdloop.c
diffstat 7 files changed, 97 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Sep 20 01:25:48 2003 +0000
+++ b/lisp/ChangeLog	Sat Sep 20 01:47:03 2003 +0000
@@ -1,3 +1,12 @@
+2003-09-20  Ilya N. Golubev  <gin@mo.msk.ru>
+
+	* simple.el (raw-append-message): Allow user to specify
+	alternative function for displaying message.
+	(redisplay-echo-area-function): New.
+	(clear-message): Allow user to specify function for finishing
+	message display.
+	(undisplay-echo-area-function): New.
+
 2003-09-20  James LewisMoss  <dres@lewismoss.org>
 
 	* font-menu.el (font-menu-max-number): New variable to specify
--- a/lisp/simple.el	Sat Sep 20 01:25:48 2003 +0000
+++ b/lisp/simple.el	Sat Sep 20 01:47:03 2003 +0000
@@ -4052,6 +4052,16 @@
   :type '(repeat (symbol :tag "Label"))
   :group 'log-message)
 
+(defcustom redisplay-echo-area-function 'redisplay-echo-area
+  "The function to call to display echo area buffer."
+:type 'function
+:group 'log-message)
+
+(defcustom undisplay-echo-area-function nil
+  "The function to call to undisplay echo area buffer."
+:type 'function
+:group 'log-message)
+
 ;;Subsumed by view-lossage
 ;; Not really, I'm adding it back by popular demand. -slb
 (defun show-message-log ()
@@ -4145,6 +4155,8 @@
     (remove-message label frame)
     (let ((inhibit-read-only t))
       (erase-buffer " *Echo Area*"))
+    (if undisplay-echo-area-function
+	(funcall undisplay-echo-area-function))
     ;; If outputting to the terminal, make sure we clear the left side.
     (when (or clear-stream
 	      (and (eq 'stream (frame-type frame))
@@ -4226,7 +4238,7 @@
       (if (not executing-kbd-macro)
 	  (if (eq 'stream (frame-type frame))
 	      (send-string-to-terminal message stdout-p (frame-device frame))
-	    (redisplay-echo-area))))))
+	    (funcall redisplay-echo-area-function))))))
 
 (defun display-message (label message &optional frame stdout-p)
   "Print a one-line message at the bottom of the frame.  First argument
--- a/man/ChangeLog	Sat Sep 20 01:25:48 2003 +0000
+++ b/man/ChangeLog	Sat Sep 20 01:47:03 2003 +0000
@@ -1,3 +1,12 @@
+2003-09-20  Ilya N. Golubev  <gin@mo.msk.ru>
+
+	* xemacs/mini.texi (Minibuffer): Add customizing message display
+	reference.
+	* lispref/display.texi (Customizing Message Display): New,
+	describe `redisplay-echo-area-function',
+	`undisplay-echo-area-function', `minibuffer-echo-wait-function'.
+	(The Echo Area): Add menu.
+
 2003-09-19  Sandra Wambold  <wambold@xemacs.org>
 
 	* Makefile: add targets to produce PDF files
--- a/man/lispref/display.texi	Sat Sep 20 01:25:48 2003 +0000
+++ b/man/lispref/display.texi	Sat Sep 20 01:47:03 2003 +0000
@@ -170,6 +170,9 @@
 @cite{XEmacs Lisp Reference Manual} specifies the rules for resolving conflicts
 between the echo area and the minibuffer for use of that screen space
 (@pxref{Minibuffer,, The Minibuffer, xemacs, The XEmacs Lisp Reference Manual}).
+Such a conflicts may be avoided at all as described in @ref{Customizing Message
+Display}.
+
 Error messages appear in the echo area; see @ref{Errors}.
 
 You can write output in the echo area by using the Lisp printing
@@ -349,6 +352,43 @@
 for brief periods of time.
 @end defvar
 
+@menu
+* Customizing Message Display::
+@end menu
+
+@node Customizing Message Display
+@subsection Customizing Message Display
+
+Message display function specify message intended for echo area by
+putting message text into @code{" *Echo Area*"} buffer.  When event
+loop code decides to update display after displaying the message, text
+of this buffer is erased.  How exactly the text will be displayed may
+be affected by the following.
+
+@findex redisplay-echo-area
+@defvar redisplay-echo-area-function
+The function called to display echo area text.  The default variable
+value, @code{redisplay-echo-area} function, does that by displaying
+the text in the same place on the screen as the echo area.  So does
+other redisplay code.  User code can avoid this regardless of what
+redisplay code will run afterwards by erasing text of @code{" *Echo
+Area*"} buffer.
+@end defvar
+
+@defvar undisplay-echo-area-function
+The variable value, if non-@code{nil}, is called by command loop after
+erasing text of @code{" *Echo Area*"} buffer.  It must clean up data
+created by @code{redisplay-echo-area-function} value.
+@end defvar
+
+@defvar minibuffer-echo-wait-function
+The function is called by command loop only when minibuffer was active
+and message was displayed (text appeared in @code{" *Echo Area*"}
+buffer).  It must wait after displaying message so that user can read
+it.  By default, when the variable value is @code{nil}, the equivalent
+of @code{(sit-for 2)} is run.
+@end defvar
+
 @node Warnings
 @section Warnings
 
--- a/man/xemacs/mini.texi	Sat Sep 20 01:25:48 2003 +0000
+++ b/man/xemacs/mini.texi	Sat Sep 20 01:47:03 2003 +0000
@@ -1,3 +1,4 @@
+
 
 @node Minibuffer, M-x, Undo, Top
 @chapter The Minibuffer
@@ -31,8 +32,10 @@
 minibuffer, by typing @kbd{C-g}.
 
   Since the minibuffer uses the screen space of the echo area, it can
-conflict with other ways XEmacs customarily uses the echo area.  Here is
-how XEmacs handles such conflicts:
+conflict with other ways XEmacs customarily uses the echo area.  One can
+avoid such a conflict as described in @ref{Customizing Message
+Display,,,lispref, The XEmacs Lisp Reference Manual}.  Here is how
+XEmacs handles such conflicts by default:
 
 @itemize @bullet
 @item
--- a/src/ChangeLog	Sat Sep 20 01:25:48 2003 +0000
+++ b/src/ChangeLog	Sat Sep 20 01:47:03 2003 +0000
@@ -1,3 +1,10 @@
+2003-09-20  Ilya N. Golubev  <gin@mo.msk.ru>
+
+	* cmdloop.c (Fcommand_loop_1): Allow specifying elisp function for
+	waiting user input while displaying message while in minibuffer.
+	(Vminibuffer_echo_wait_function): New, associated variable...
+	(vars_of_cmdloop): ... initialize it.
+
 2003-09-20  James LewisMoss  <dres@lewismoss.org>
 
 	* console-impl.h (struct console_methods): add third arg to list_fonts
--- a/src/cmdloop.c	Sat Sep 20 01:25:48 2003 +0000
+++ b/src/cmdloop.c	Sat Sep 20 01:47:03 2003 +0000
@@ -68,6 +68,7 @@
 Lisp_Object Qerrors_deactivate_region;
 
 Lisp_Object Qtop_level;
+Lisp_Object Vminibuffer_echo_wait_function;
 
 static Lisp_Object command_loop_1 (Lisp_Object dummy);
 EXFUN (Fcommand_loop_1, 0);
@@ -559,7 +560,10 @@
 	  /* Bind dont_check_for_quit to 1 so that C-g gets read in
 	     rather than quitting back to the minibuffer.  */
 	  int count = begin_dont_check_for_quit ();
-	  Fsit_for (make_int (2), Qnil);
+	  if (!NILP (Vminibuffer_echo_wait_function))
+	    call0 (Vminibuffer_echo_wait_function);
+	  else
+	    Fsit_for (make_int (2), Qnil);
 	  clear_echo_area (selected_frame (), Qnil, 0);
 	  Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */
 	  unbind_to (count);
@@ -626,6 +630,15 @@
 */ );
   Venter_window_hook = Qnil;
 
+  DEFVAR_LISP ("minibuffer-echo-wait-function",
+	       &Vminibuffer_echo_wait_function /*
+The function called by command loop when minibuffer was active and
+message was displayed (text appeared in \" *Echo Area*\" buffer).  It
+must wait after displaying message so that user can read it.  If the
+variable value is `nil', the equivalent of `(sit-for 2)' is run.
+*/ );
+  Vminibuffer_echo_wait_function = Qnil;
+
 #ifndef LISP_COMMAND_LOOP
   DEFVAR_LISP ("top-level", &Vtop_level /*
 Form to evaluate when Emacs starts up.