From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Klaus Berndl Newsgroups: gmane.emacs.help Subject: Re: Question to completion Date: 08 Nov 2003 15:14:52 +0100 Organization: "sd&m AG, Muenchen, Germany" Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1068301822 2132 80.91.224.253 (8 Nov 2003 14:30:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 8 Nov 2003 14:30:22 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 08 15:30:20 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AIU6W-0006Qw-00 for ; Sat, 08 Nov 2003 15:30:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AIV3Q-0006KN-Hx for geh-help-gnu-emacs@m.gmane.org; Sat, 08 Nov 2003 10:31:12 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.telusplanet.net!newsfeed.telus.net!news3.optonline.net!newsfeed.kabelfoon.nl!195.129.110.21.MISMATCH!bnewsfeed00.bru.ops.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!emea.uu.net!news.sdm.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 60 Original-NNTP-Posting-Host: callin50.muc.sdm.de Original-X-Trace: news.sdm.de 1068300894 29008 195.125.139.50 (8 Nov 2003 14:14:54 GMT) Original-X-Complaints-To: usenet@news.sdm.de Original-NNTP-Posting-Date: Sat, 8 Nov 2003 14:14:54 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Xref: shelby.stanford.edu gnu.emacs.help:118013 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13952 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13952 Until now i have written a first solution which does what i want: (defun offer-some-choices () (interactive) ;; With these 3 TAB-events we ensure that ;; 1. The longest possible common substring is display in the minibuffer ;; 2. All possible completions are displayed (setq unread-command-events (cons 9 unread-command-events)) (setq unread-command-events (cons 9 unread-command-events)) (setq unread-command-events (cons 9 unread-command-events)) (let ((file (completing-read "Select a file: " '(("c:/Programme/emacs-21/site-lisp/semantic/semanticdb-test.el" . t) ("c:/Programme/emacs-21/site-lisp/ecb-navigate.el" . t))))) (message "Choosen file: %s" file))) Now my question: Is this completely an ugly hack and what to do to write this better? Thanks for help, Klaus On 08 Nov 2003, Klaus Berndl wrote: > > Suppose i have s command like follows: > > (defun offer-some-choices () > (interactive) > (completing-read "Select a name: " '(("Klaus" . t) ("Berndl" . t)))) > > Then this displays in the minibuffer "Select a name: " and then wait for > input from the user. > > How can i achieve that always - *without* the user has to hit TAB - the > possible completions are displayed immediately? Or with other words: How to > simulate that the user has already pressed TAB as often as necessary to > display all possible completions? Best would be if the longest common > substring of all possible completions is displayed immediately in the > minibuffer (OK, this i could precompute with `try-completion' and then > insert as argument INITIAL-INPUT - but AFAIK this is deprecated?!). > > But most important is that the user has not to hit any key to see all > possible completions. How to do this with completing-read - or is there a > better way to do this? > > What i want is to (mis?)use the completion-feature of Emacs to offer the > user some choices which he can select either via mouse or via keyboard from > the minibuffer. > > Thanks a lot in advance! > Klaus -- Klaus Berndl mailto: klaus.berndl@sdm.de sd&m AG http://www.sdm.de software design & management Carl-Wery-Str. 42, 81739 Muenchen, Germany Tel +49 89 63812-392, Fax -220