bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Switch to other buffer improvement


From: Roland Winkler
Subject: Re: Switch to other buffer improvement
Date: 30 Jun 2004 14:37:31 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"Adam Purkrt" <adam.purkrt@cmail.cz> 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)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]