unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Potential problem of minibuffer-message
@ 2003-04-10  1:44 Kenichi Handa
  2003-04-10 13:44 ` Stefan Monnier
  2003-04-10 22:47 ` Richard Stallman
  0 siblings, 2 replies; 11+ messages in thread
From: Kenichi Handa @ 2003-04-10  1:44 UTC (permalink / raw)


I'd like to install the attached change.

Currently, minibuffer-message calls temp_echo_area_glyphs
with the arg SDATA (string), and temp_echo_area_glyphs
inserts it by insert_string function.  But insert_string
should not be used for the contents of Lisp string.  My fix
changes the arg of temp_echo_area_glyphs to Lisp string, and
use insert_from_string to insert it.

I also want to add the optional arg TIMEOUT to
minibuffer-message and temp_echo_area_glyphs.  It is to
specify how long to display the text instead of the defualt
two seconds.

I need TIMEOUT because I'm going to change quail to use just
`message' (normal case) or `minibuffer-message' (the case of
inputting in a minibuffer) to display the guidance string.
In the latter case, the two seconds is too short.

By the way, minibuffer-message is not described in Elisp
info nor in NEWS.

---
Ken'ichi HANDA
handa@m17n.org

*** minibuf.c.~1.254.~	Sat Jan 25 09:10:34 2003
--- minibuf.c	Thu Apr 10 10:35:29 2003
***************
*** 1719,1725 ****
    if (NILP (completion))
      {
        bitch_at_user ();
!       temp_echo_area_glyphs (" [No match]");
        UNGCPRO;
        return 0;
      }
--- 1719,1725 ----
    if (NILP (completion))
      {
        bitch_at_user ();
!       temp_echo_area_glyphs (build_string (" [No match]"), Qnil);
        UNGCPRO;
        return 0;
      }
***************
*** 1783,1789 ****
        else if (!NILP (Vcompletion_auto_help))
  	Fminibuffer_completion_help ();
        else
! 	temp_echo_area_glyphs (" [Next char not unique]");
        return 6;
      }
    else if (completedp)
--- 1783,1789 ----
        else if (!NILP (Vcompletion_auto_help))
  	Fminibuffer_completion_help ();
        else
! 	temp_echo_area_glyphs (build_string (" [Next char not unique]"), Qnil);
        return 6;
      }
    else if (completedp)
***************
*** 1882,1894 ****
      case 1:
        if (PT != ZV)
  	Fgoto_char (make_number (ZV));
!       temp_echo_area_glyphs (" [Sole completion]");
        break;
  
      case 3:
        if (PT != ZV)
  	Fgoto_char (make_number (ZV));
!       temp_echo_area_glyphs (" [Complete, but not unique]");
        break;
      }
  
--- 1882,1895 ----
      case 1:
        if (PT != ZV)
  	Fgoto_char (make_number (ZV));
!       temp_echo_area_glyphs (build_string (" [Sole completion]"), Qnil);
        break;
  
      case 3:
        if (PT != ZV)
  	Fgoto_char (make_number (ZV));
!       temp_echo_area_glyphs (build_string (" [Complete, but not unique]"),
! 			     Qnil);
        break;
      }
  
***************
*** 1949,1955 ****
      case 4:
        if (!NILP (Vminibuffer_completion_confirm))
  	{
! 	  temp_echo_area_glyphs (" [Confirm]");
  	  return Qnil;
  	}
        else
--- 1950,1956 ----
      case 4:
        if (!NILP (Vminibuffer_completion_confirm))
  	{
! 	  temp_echo_area_glyphs (build_string (" [Confirm]"), Qnil);
  	  return Qnil;
  	}
        else
***************
*** 1986,1992 ****
    if (NILP (completion))
      {
        bitch_at_user ();
!       temp_echo_area_glyphs (" [No match]");
        return Qnil;
      }
    if (EQ (completion, Qt))
--- 1987,1993 ----
    if (NILP (completion))
      {
        bitch_at_user ();
!       temp_echo_area_glyphs (build_string (" [No match]"), Qnil);
        return Qnil;
      }
    if (EQ (completion, Qt))
***************
*** 2344,2350 ****
    if (NILP (completions))
      {
        bitch_at_user ();
!       temp_echo_area_glyphs (" [No completions]");
      }
    else
      internal_with_output_to_temp_buffer ("*Completions*",
--- 2345,2351 ----
    if (NILP (completions))
      {
        bitch_at_user ();
!       temp_echo_area_glyphs (build_string (" [No completions]"), Qnil);
      }
    else
      internal_with_output_to_temp_buffer ("*Completions*",
***************
*** 2388,2402 ****
  }
  
  \f
! /* Temporarily display the string M at the end of the current
!    minibuffer contents.  This is used to display things like
!    "[No Match]" when the user requests a completion for a prefix
!    that has no possible completions, and other quick, unobtrusive
!    messages.  */
  
  void
! temp_echo_area_glyphs (m)
!      const char *m;
  {
    int osize = ZV;
    int osize_byte = ZV_BYTE;
--- 2389,2403 ----
  }
  
  \f
! /* Temporarily display STRING at the end of the current minibuffer
!    contents for TIMEOUT seconds.  This is used to display things like
!    "[No Match]" when the user requests a completion for a prefix that
!    has no possible completions, and other quick, unobtrusive
!    messages.  If TIMEOUT is not number, it defaults to 2.  */
  
  void
! temp_echo_area_glyphs (string, timeout)
!      Lisp_Object string, timeout;
  {
    int osize = ZV;
    int osize_byte = ZV_BYTE;
***************
*** 2409,2418 ****
    message (0);
  
    SET_PT_BOTH (osize, osize_byte);
!   insert_string (m);
    SET_PT_BOTH (opoint, opoint_byte);
    Vinhibit_quit = Qt;
!   Fsit_for (make_number (2), Qnil, Qnil);
    del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1);
    SET_PT_BOTH (opoint, opoint_byte);
    if (!NILP (Vquit_flag))
--- 2410,2421 ----
    message (0);
  
    SET_PT_BOTH (osize, osize_byte);
!   insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0);
    SET_PT_BOTH (opoint, opoint_byte);
    Vinhibit_quit = Qt;
!   if (! NUMBERP (timeout))
!     timeout = make_number (2);
!   Fsit_for (timeout, Qnil, Qnil);
    del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1);
    SET_PT_BOTH (opoint, opoint_byte);
    if (!NILP (Vquit_flag))
***************
*** 2424,2438 ****
  }
  
  DEFUN ("minibuffer-message", Fminibuffer_message, Sminibuffer_message,
!        1, 1, 0,
         doc: /* Temporarily display STRING at the end of the minibuffer.
! The text is displayed for two seconds,
! or until the next input event arrives, whichever comes first.  */)
!      (string)
!      Lisp_Object string;
  {
    CHECK_STRING (string);
!   temp_echo_area_glyphs (SDATA (string));
    return Qnil;
  }
  \f
--- 2427,2445 ----
  }
  
  DEFUN ("minibuffer-message", Fminibuffer_message, Sminibuffer_message,
!        1, 2, 0,
         doc: /* Temporarily display STRING at the end of the minibuffer.
! The text is displayed for two seconds by default,
! or until the next input event arrives, whichever comes first.
! The optional second arg TIMEOUT, if non-nil, specifies how long to
! display the text instead of two seconds.  */)
!      (string, timeout)
!      Lisp_Object string, timeout;
  {
    CHECK_STRING (string);
!   if (! NILP (timeout))
!     CHECK_NUMBER (timeout);
!   temp_echo_area_glyphs (string, timeout);
    return Qnil;
  }
  \f

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-04-13 11:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-10  1:44 Potential problem of minibuffer-message Kenichi Handa
2003-04-10 13:44 ` Stefan Monnier
2003-04-11  2:22   ` Kenichi Handa
2003-04-11  2:38     ` Miles Bader
2003-04-11  4:31       ` Kenichi Handa
2003-04-11  4:37         ` Miles Bader
2003-04-11  4:53           ` overlay property `after-string' Kenichi Handa
2003-04-11  5:02             ` Miles Bader
2003-04-11  6:30               ` Kenichi Handa
2003-04-13 11:23     ` Potential problem of minibuffer-message Richard Stallman
2003-04-10 22:47 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).