From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: C-r and C-s in minibuffer should search completion Date: Sun, 30 Mar 2008 02:38:59 +0200 Organization: JURTA Message-ID: <87y7816odc.fsf@jurta.org> References: <87fxul194g.fsf@jurta.org> <200803290100.m2T10S3j007668@localhost.localdomain> <877iflk8zy.fsf@jurta.org> <001901c891b9$3e6c95a0$0200a8c0@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1206839213 971 80.91.229.12 (30 Mar 2008 01:06:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Mar 2008 01:06:53 +0000 (UTC) Cc: 'Xavier Maillard' , monnier@iro.umontreal.ca, emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 30 03:07:24 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 1Jfm12-0002nU-Kr for ged-emacs-devel@m.gmane.org; Sun, 30 Mar 2008 03:07:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jfm0R-0006Tz-0Y for ged-emacs-devel@m.gmane.org; Sat, 29 Mar 2008 21:06:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jflyn-0004xd-UE for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:05:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jflym-0004we-UE for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:05:01 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jflym-0004wT-QP for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:05:00 -0400 Original-Received: from relay03.kiev.sovam.com ([62.64.120.201]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jflyi-0002FP-6y; Sat, 29 Mar 2008 21:04:56 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay03.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1Jflye-000Byw-D1; Sun, 30 Mar 2008 04:04:54 +0300 In-Reply-To: <001901c891b9$3e6c95a0$0200a8c0@us.oracle.com> (Drew Adams's message of "Sat, 29 Mar 2008 09:23:37 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 21f1cdc77deae757bfd40713fd6c3781 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2516 [Mar 28 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 10 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) 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:93853 Archived-At: >> Maybe we should avoid this inconsistency by using >> another key for switch-to-completions? > > FWIW, Icicles uses `C-insert' for this. And hitting it again takes you back to > the minibuffer (and copies the completion at point in *Completions* to the > minibuffer` for editing). That key won't work for emacs -nw, but `M-insert' > presumably would (in the form of `ESC insert'). I agree that `M-insert' makes sense for inserting the completion from the *Completions* buffer to the minibuffer. > There is little connection between the idea of having `down' and `up' move to > the next and previous items in a series and the idea of switching > windows/buffers. and are used by many other programs that open a pop-up list of history/completion items. So they are natural key for most users and especially for newbies. I also suggest using for IDE-like autocompletion that opens a pop-up window with completion in a program buffer. This is usually bound to C-SPC in IDE like Eclipse, but C-SPC is already taken for set-mark-command in Emacs. > Finally, why use a separate window for history items? Why not simply use > *Completions* and let users complete against history items? IOW, use the normal > completion mechanism, with everything that it provides. As there exists already a key that open the *Completions* buffer, it makes sense to do the same for the history list. Below is a patch that implements these ideas. > That is what I suggested when I mentioned `M-o', which is the key that Icicles > uses for this. You can use `M-o' from any minibuffer, not just during > completion. It uses a recursive minibuffer to let you choose from the current > input history (using completion) - your choice is inserted in the minibuffer, > where you can edit it for the original minibuffer reading. You earlier objected to using the same keys that have different bindings in the minibuffer and outside it (cf. using `TAB' in the minibuffer). Since by default M-o is a prefix key for font-lock-fontify function, I think we should find another key. One candidate I propose is C-M-TAB. Index: lisp/simple.el =================================================================== RCS file: /sources/emacs/emacs/lisp/simple.el,v retrieving revision 1.913 diff -c -r1.913 simple.el *** lisp/simple.el 29 Mar 2008 22:56:17 -0000 1.913 --- lisp/simple.el 30 Mar 2008 00:38:48 -0000 *************** *** 5520,5525 **** --- 5574,5604 ---- (goto-char (point-min)) (search-forward "\n\n" nil t) (forward-line 1)))) + + (defun switch-to-history-completions () + "Select the completion list window for elements of the minibuffer history." + (interactive) + (let ((minibuffer-completion-table + (symbol-value minibuffer-history-variable)) + (minibuffer-completion-predicate nil)) + (switch-to-completions))) + + (define-key minibuffer-local-completion-map [(meta down)] 'switch-to-completions) + (define-key minibuffer-local-completion-map [(meta up)] 'switch-to-history-completions) + + (defun minibuffer-history-complete () + "Complete the minibuffer input against the history list. + Locally bind the current value of `minibuffer-history-variable' + to the completion table `minibuffer-completion-table' before + calling `minibuffer-complete'." + (interactive) + (let ((minibuffer-completion-table + (symbol-value minibuffer-history-variable)) + (minibuffer-completion-predicate nil)) + (minibuffer-complete))) + + (define-key minibuffer-local-map [(meta control tab)] 'minibuffer-history-complete) + ;;; Support keyboard commands to turn on various modifiers. -- Juri Linkov http://www.jurta.org/emacs/