From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Potential problem of minibuffer-message Date: Thu, 10 Apr 2003 10:44:12 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200304100144.KAA16944@etlken.m17n.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1049939087 23134 80.91.224.249 (10 Apr 2003 01:44:47 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 10 Apr 2003 01:44:47 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Apr 10 03:44:43 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 193R7L-00060Y-00 for ; Thu, 10 Apr 2003 03:44:43 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 193RC5-0001Ln-00 for ; Thu, 10 Apr 2003 03:49:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 193R7H-00064I-06 for emacs-devel@quimby.gnus.org; Wed, 09 Apr 2003 21:44:39 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 193R6v-00063R-00 for emacs-devel@gnu.org; Wed, 09 Apr 2003 21:44:17 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 193R6t-00063A-00 for emacs-devel@gnu.org; Wed, 09 Apr 2003 21:44:16 -0400 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 193R6t-00062u-00 for emacs-devel@gnu.org; Wed, 09 Apr 2003 21:44:15 -0400 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h3A1iDo22462 for ; Thu, 10 Apr 2003 10:44:13 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) by fs.m17n.org (8.11.6/3.7W-20010823150639) with ESMTP id h3A1iCA04297 for ; Thu, 10 Apr 2003 10:44:12 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id KAA16944; Thu, 10 Apr 2003 10:44:12 +0900 (JST) Original-To: emacs-devel@gnu.org 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) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13098 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13098 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 **** } ! /* 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; }