emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Potential problem of minibuffer-message


From: Kenichi Handa
Subject: Potential problem of minibuffer-message
Date: Thu, 10 Apr 2003 10:44:12 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

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
address@hidden

*** 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 ****
  }
  
  
! /* 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 ----
  }
  
  
! /* 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;
  }
  
--- 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;
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]