From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: C-r and C-s in minibuffer should search completion Date: Tue, 25 Mar 2008 22:31:15 -0400 Message-ID: References: <87prtiik0l.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1206498718 8990 80.91.229.12 (26 Mar 2008 02:31:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Mar 2008 02:31:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 26 03:32:28 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JeLRA-0001sF-JG for ged-emacs-devel@m.gmane.org; Wed, 26 Mar 2008 03:32:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeLQZ-0004Mr-8S for ged-emacs-devel@m.gmane.org; Tue, 25 Mar 2008 22:31:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JeLQ6-0003zW-H6 for emacs-devel@gnu.org; Tue, 25 Mar 2008 22:31:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JeLQ5-0003yR-Nc for emacs-devel@gnu.org; Tue, 25 Mar 2008 22:31:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeLQ5-0003yA-Ge for emacs-devel@gnu.org; Tue, 25 Mar 2008 22:31:17 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JeLQ5-0007DL-AM for emacs-devel@gnu.org; Tue, 25 Mar 2008 22:31:17 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah8FAN1R6UdMCrTo/2dsb2JhbACBWqkI X-IronPort-AV: E=Sophos;i="4.25,555,1199682000"; d="scan'208";a="16673776" Original-Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 25 Mar 2008 22:31:16 -0400 Original-Received: from pastel.home ([76.10.180.232]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id GFF55415; Tue, 25 Mar 2008 22:31:15 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 27A367F9E; Tue, 25 Mar 2008 22:31:15 -0400 (EDT) In-Reply-To: <87prtiik0l.fsf@jurta.org> (Juri Linkov's message of "Tue, 25 Mar 2008 23:44:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:93485 Archived-At: >> I believe C-s and C-r in the minibuffer should not only search the >> history but the completion table as well (at least when it's not >> a function). >> >> Could someone implement this feature? > I now have an idea how to implement this feature. > Some time ago I submitted a patch that introduces a new variable > `minibuffer-default-set-function' that extends a list of defaults > when minibuffer position hits the bottom of the list of defaults. How would that help? M-r/M-s doesn't seem to search minibuffer-default. But I guess it does help with C-s, which is what I mistyped. Actually, now that I take a closer look. Why do we have both C-s/C-r and M-r/M-s? They seem redundant. > + (defun minibuffer-default-add-completions () > + "Return a list of all completions without the default value. > + This function is used to add all elements of the completion table to > + the end of the list of defaults after the default value." > + (interactive) > + (let ((def minibuffer-default) > + (all (all-completions "" > + minibuffer-completion-table > + minibuffer-completion-predicate > + t))) > + (if (listp def) > + (append def all) > + (setq all (cons def (delete def all)))))) This is not good when the completion table is a function that takes a long time, because then you have to wait for the completion table to be built before you can get the actual real DEF. Better would be to call the function only after we consumed minibuffer-default. Or maybe only do it when the completion-table is not a function. Stefan