unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Potential problem of minibuffer-message
Date: Thu, 10 Apr 2003 09:44:22 -0400	[thread overview]
Message-ID: <200304101344.h3ADiMe3003713@rum.cs.yale.edu> (raw)
In-Reply-To: 200304100144.KAA16944@etlken.m17n.org

> 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)))))))))

  reply	other threads:[~2003-04-10 13:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-10  1:44 Potential problem of minibuffer-message Kenichi Handa
2003-04-10 13:44 ` Stefan Monnier [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200304101344.h3ADiMe3003713@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).