emacs-devel
[Top][All Lists]
Advanced

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

Re: position on changing defaults?


From: Juri Linkov
Subject: Re: position on changing defaults?
Date: Sat, 08 Mar 2008 23:09:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu)

>     When doing C-x b it will start by showing in the minibuffer a list of
>     the buffers.
>
> I think I would find that very annoying.  I tend to have 50 buffers or
> more.
>
> I don't think this should be the default, not just for C-x b,
> and not for anything else either.

I have a patch that implements the best part of iswitchb functionality
without changing the default minibuffer user interface.  It provides
the following benefits:

1. After typing C-x b: each M-n (or down-arrow) key will put the
next buffer name to the minibuffer, starting with the most recent
buffer and going in the order buffers are stored in the buffer list.

2. After typing C-x b: C-s or C-M-s will incrementally search the
buffer list for the buffer name that matches the search string or
regexp. So to switch to the buffer, the users can simply type any
unique part of the buffer name or to repeatedly type C-s until seeing
the needed buffer name, e.g.: `C-x b C-s [substring] C-s ... RET'

This is implemented by putting the buffer list to the list of default
values of the minibuffer created by the `interactive' code character `B':

Index: src/callint.c
===================================================================
RCS file: /sources/emacs/emacs/src/callint.c,v
retrieving revision 1.161
diff -c -r1.161 callint.c
*** src/callint.c       19 Feb 2008 04:03:01 -0000      1.161
--- src/callint.c       8 Mar 2008 21:09:16 -0000
***************
*** 520,528 ****
          break;
  
        case 'B':               /* Name of buffer, possibly nonexistent */
!         args[i] = Fread_buffer (callint_message,
!                                 Fother_buffer (Fcurrent_buffer (), Qnil, 
Qnil),
!                                 Qnil);
          break;
  
          case 'c':             /* Character */
--- 524,552 ----
          break;
  
        case 'B':               /* Name of buffer, possibly nonexistent */
!         {
!           Lisp_Object tema, temb, temc;
! 
!           /* Get a list of buffer names (except the current buffer and
!              internal buffers), and use this list for default values.  */
!           tema = Qnil;
!           temc = Fcurrent_buffer ();
!           teml = Fbuffer_list (selected_frame);
!           for (; CONSP (teml); teml = XCDR (teml))
!             {
!               temb = XCAR (teml);
!               if (EQ (temb, temc))
!                 continue;
!               if (NILP (temb))
!                 continue;
!               if (NILP (XBUFFER (temb)->name))
!                 continue;
!               if (SREF (XBUFFER (temb)->name, 0) == ' ')
!                 continue;
!               tema = Fcons (XBUFFER (temb)->name, tema);
!             }
!           args[i] = Fread_buffer (callint_message, Fnreverse (tema), Qnil);
!         }
          break;
  
          case 'c':             /* Character */

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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