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:44:17 +0200 Organization: JURTA Message-ID: <87od8xccz6.fsf@jurta.org> References: <87prtiik0l.fsf@jurta.org> <87iqz969fh.fsf@jurta.org> <87od9181m7.fsf@jurta.org> <87lk440z31.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 1206839182 919 80.91.229.12 (30 Mar 2008 01:06:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Mar 2008 01:06:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 30 03:06:52 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 1Jfm0H-0002YL-Mx for ged-emacs-devel@m.gmane.org; Sun, 30 Mar 2008 03:06:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jflzf-0005o4-SF for ged-emacs-devel@m.gmane.org; Sat, 29 Mar 2008 21:05:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jflyk-0004t7-1e for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:04:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jflyf-0004qc-CK for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:04:57 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jflyf-0004qM-7J for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:04:53 -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 1Jflye-0002EP-Jz for emacs-devel@gnu.org; Sat, 29 Mar 2008 21:04:52 -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 1JflyZ-000ByJ-4x; Sun, 30 Mar 2008 04:04:47 +0300 In-Reply-To: (Stefan Monnier's message of "Sat, 29 Mar 2008 00:03:42 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: f7f1c38b0b2d7aeba17750d70212ab70 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 [0255], 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:93852 Archived-At: >> In the patch below I renamed minibuffer-default-add-p into >> minibuffer-default-add-done, changed its default to nil, and >> removed make-variable-buffer-local for minibuffer-default-add-function. > > Thanks, please install it. Done. I also reverted the recent change in `call-interactively' that adds buffers to the list of defaults. However, there is one problem now: `C-x b M-n M-n' puts in the minibuffer the name of the current buffer because the current buffer is in the front of the buffer list acquired from the completion table in read-buffer. But it makes no sense to switch to the current buffer, so the case 'B' in `call-interactively' specially removes the current buffer from the default value by using `Fother_buffer' specially for the command `switch-to-buffer'. I see no other way of removing the current buffer from the list for M-n than using the following patch for `minibuffer-default-add-completions'. It seems there is no other suitable place to remove the current buffer in the call chain: `C-x b' -> `call-interactively' -> `read-buffer' -> `completing-read' with `internal-complete-buffer' -> `minibuffer-default-add-completions'. This change should also work for all commands that read a buffer name because when they need the current buffer, they usually put the current buffer to the default value. So it would be ok to remove it from the list. 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:43:14 -0000 *************** *** 1332,1337 **** --- 1333,1343 ---- minibuffer-completion-table minibuffer-completion-predicate t))) + + ;; Remove the current buffer from the list of buffer completions + (when (eq minibuffer-completion-table 'internal-complete-buffer) + (setq all (cdr all))) + (if (listp def) (append def all) (cons def (delete def all))))) -- Juri Linkov http://www.jurta.org/emacs/