From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: Potential problem of minibuffer-message Date: Thu, 10 Apr 2003 09:44:22 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200304101344.h3ADiMe3003713@rum.cs.yale.edu> References: <200304100144.KAA16944@etlken.m17n.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1049982575 27948 80.91.224.249 (10 Apr 2003 13:49:35 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 10 Apr 2003 13:49:35 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Apr 10 15:49:31 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 193cQl-0007G5-00 for ; Thu, 10 Apr 2003 15:49:31 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 193cVk-0008Db-00 for ; Thu, 10 Apr 2003 15:54:41 +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 193cQj-0005ML-03 for emacs-devel@quimby.gnus.org; Thu, 10 Apr 2003 09:49:29 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 193cPE-0004SD-00 for emacs-devel@gnu.org; Thu, 10 Apr 2003 09:47:56 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 193cNW-00038S-00 for emacs-devel@gnu.org; Thu, 10 Apr 2003 09:46:12 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 193cLm-0002Ud-00 for emacs-devel@gnu.org; Thu, 10 Apr 2003 09:44:23 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h3ADiMx6003715; Thu, 10 Apr 2003 09:44:22 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h3ADiMe3003713; Thu, 10 Apr 2003 09:44:22 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Kenichi Handa 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:13117 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13117 > 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. As part of my still-in-progress rewrite of completion in elisp, I use the following (partly taken from complete.el where it is called PC-temp-minibuffer-message or somesuch). Note how it already works in both case: from the minibuffer or from some other buffer. And actually pcomplete needs to be patched to use this function in place of `message' so as to be more usable for minibuffer-completion. Stefan (defun minibuffer-message (message &rest args) "Temporarily display STRING at the end of the minibuffer. The text is displayed for `minibuffer-message-timeout' seconds, or until the next input event arrives, whichever comes first." (cond ((not (minibuffer-p (current-buffer))) (apply 'message message args) (sit-for (or minibuffer-message-timeout 1000000)) (message nil)) (t (let ((point-max (point-max))) (message nil) (save-excursion (goto-char point-max) (insert (apply 'format (if (string-match "\\[.*\\]" message) message (concat " [" message "]")) args)) (let ((inhibit-quit t)) (sit-for (or minibuffer-message-timeout 1000000)) (delete-region point-max (point)) (when quit-flag (setq quit-flag nil unread-command-events '(7)))))))))