From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Roland Winkler Newsgroups: gmane.emacs.bugs Subject: Re: Switch to other buffer improvement Date: 30 Jun 2004 14:37:31 +0200 Sender: bug-gnu-emacs-bounces+geb-bug-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 1088599147 29076 80.91.224.253 (30 Jun 2004 12:39:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 30 Jun 2004 12:39:07 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 30 14:38:59 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BfeMd-0006DF-00 for ; Wed, 30 Jun 2004 14:38:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BfeOL-0005yG-Hx for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Jun 2004 08:40:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BfeOJ-0005yA-Lb for bug-gnu-emacs@gnu.org; Wed, 30 Jun 2004 08:40:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BfeOH-0005xy-Ol for bug-gnu-emacs@gnu.org; Wed, 30 Jun 2004 08:40:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BfeOH-0005xv-LM for bug-gnu-emacs@gnu.org; Wed, 30 Jun 2004 08:40:41 -0400 Original-Received: from [131.188.3.181] (helo=max71.rrze.uni-erlangen.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BfeMH-0002si-5C for bug-gnu-emacs@gnu.org; Wed, 30 Jun 2004 08:38:37 -0400 Original-Received: from tfkp07.physik.uni-erlangen.de (tfkp07.physik.uni-erlangen.de [131.188.164.207]) by max71.rrze.uni-erlangen.de with ESMTP; Wed, 30 Jun 2004 14:37:32 +0200 Original-To: "Adam Purkrt" In-Reply-To: Original-Lines: 33 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:8315 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:8315 "Adam Purkrt" writes: > I'd like to suggest an improvement to Emacs. > > Example situation: I have opened "style1.css", "style2.css" and > "foo.html". Active buffer is "style1.css". I want to switch to > style2.css. Press C-x b, type "s", press tab, it completes to > "style", then I have to type "2", press tab again and finally > switch to "style2.css". > > I think, that Emacs should complete to "style2.css" immediately > after typing "s", because when I'm switching to another buffer I > don't want to stay in the same. > > Simply said - when switching, the active buffer should be excluded > from the completion-list. Put this in your .emacs (setq read-buffer-function 'read-buffer-different) (defun read-buffer-different (prompt &optional default require-match) "Read buffer with minibuffer completion not including current-buffer." (let ((bl (buffer-list)) (cb (current-buffer)) buf dbl) (while (setq buf (car bl)) (unless (eq buf cb) (push (buffer-name buf) dbl)) (setq bl (cdr bl))) (completing-read (if default (concat prompt "(default " default ") ") prompt) dbl nil require-match nil 'buffer-name-history default)))