emacs-devel
[Top][All Lists]
Advanced

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

buffer order [was: isearch multiple buffers]


From: Drew Adams
Subject: buffer order [was: isearch multiple buffers]
Date: Wed, 24 Oct 2007 09:31:54 -0700

> From: Drew Adams Sent: Tuesday, October 23, 2007 5:33 PM
>
> how about at least letting a user search, say, all of the
> buffers marked (with `>') in the Buffer List (C-x C-b),
> in the order they currently appear in that list? That is, have
> the default value of `isearch-buffers-next-buffer-function'
> be a function that provides this behavior.
...
> Buffer List already offers one way to select buffers and order
> them. And if this were available, it might also serve as an
> incentive to have one or more buffer-menu commands that mark
> buffers according to a regexp - similar to
> what `dired-mark-files-regexp' does.

Some follow-up on this idea. I don't have time to work on this, but in case
someone else is interested -

You can now sort the Buffer List by any column, but you cannot define a
custom buffer order (there is currently no use for that). If you could, then
any function that operated on multiple buffers or upon the "next" or
"previous" buffer could take advantage of that order. Isearch is one
example.

For instance, if there were marked buffers in Buffer List, then
`next-buffer' would use the buffer order there, instead of the internal
buffer order: `next-buffer' would mean the next marked buffer after the
current buffer (which might or might not be marked). If no buffers were
marked, the behavior would be as it is now.

For this feature, users would need a way to define a custom order among the
marked buffers. There are various UI possibilities for this (drag-and-drop
etc.).  Here's one that's simple for the user.

1. Add a buffer-number (e.g. line number) column at the left (it could even
be part of the poorly named "CRM" column):

      Buffer      Size  Mode             File
 1. * *Messages*   232  Fundamental
 2 %  foobar     45391  Dired by name    /toto/foobar
 3>   tata.el    31416  Emacs Lisp       /toto/foobar/tata.el
 4    *scratch*    320  Lisp Interaction
 5 %  *Help*     10021  Help
 6>   titi.el     8754  Emacs Lisp       /toto/foobar/titi.el

2. Change the current bindings of keys `1' and `2' to something else, so
numbers can be used instead for reordering.

3.a. Bind keys so that typing a number followed by RET would set the number
of the buffer with the cursor to that input number. For example, typing `5
RET' would move the buffer with the cursor to line 5.

3.b. An alternative UI would be to let you edit the current buffer number
(e.g. change 5 to 2) for any number of lines, and then hit `g' to reorder
them all. That's the approach, for instance, of NetFlix when you reorder
your film queue. That can make it easier to move a group of buffers together
(less disorienting due to redisplay).

4. The order of the marked buffers in Buffer List would act as the current
buffer order; unmarked buffers would be ignored for operations that use
buffer order. In the example above, buffers tata.el and titi.el are marked,
so `next-buffer' and isearch would act on them in the order they appear
(tata.el, then titi.el).

I find such a UI easier than, say, dragging lines, especially when there are
lots of lines.

It would also be good to add some of the regexp and marking/unmarking
features that Dired has to Buffer List, the equivalent of
`dired-toggle-marks' and `dired-mark-files-regexp', for instance.

It would also be good to have commands to mark all buffers of a certain type
(e.g. by mode, time, size, file buffers). You could then, for instance, mark
all Emacs-Lisp buffers, then unmark a few of them that you don't want to
search, and so on.

WDOT?





reply via email to

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