> I'd like to have several buffer lists, each dedicated to a > file type, e.g., an "org-list," an "el-list," etc., to tidy
> up and better navigate the buffer ring.
> Wondering if anything like this already exists before diving into
> development myself.
Here are two things that might help, depending on what you really want to do.
Others will no doubt offer more suggestions.
1. Ibuffer (command `ibuffer') can list buffers in groups according to type, and
let you operate on them etc. Ibuffer comes with Emacs out of the box.
2. The buffer commands in Icicles (visiting/switching, killing, whatever) let
you access buffers by type in various ways: files only, same-mode,
same-or-derived-mode, same-frame. In addition, they let you use on-the-fly keys
to remove buffers in given modes etc. from the list of completion candidates.
Here is the (long) doc string for `icicle-buffer' (`C-x b' in Icicle mode), for
more info. This command happens to be a multi-command (you can do things to
multiple buffers in the same invocation) that allows multi-completion input (in
this case, match the buffer name and/or buffer content).
,---- icicle-buffer ---
| Switch to a different buffer, whose content contains a regexp match.
| By default, Icicle mode remaps all key sequences that are normally
| bound to `switch-to-buffer' to `icicle-buffer'. If you do not want
| this remapping, then customize option `icicle-top-level-key-bindings'.
| | Completion candidates are two-part multi-completions, with the second
| part optional. If both parts are present they are separated by
| `icicle-list-join-string' ("^G^J", by default).
| | The first part is matched as a regexp against a buffer name.
| The second part is matched as a regexp against buffer content.
| Candidates that do not match are filtered out.
| | Your minibuffer input can match a buffer name or buffer content, or
| both. Use `C-M-j' (equivalent here to `C-q C-g C-j') to input the
| default separator.
| | For example:
| | To match `foo' against buffer names, use input `foo'.
| To match `bar' against buffer contents, use input `C-M-j bar'.
| To match both, use input `foo C-M-j bar'.
| | Only the matching buffer names are shown in *Completions*, and only
| the chosen buffer name is returned. The actual content matches are
| unimportant anyway: content matching is used only to filter
| | This is a buffer-switching command. If you instead want to navigate
| to text searched for in buffers then use `icicle-search'.
| | The buffer-name portion of completion candidates is as follows,
| depending on the prefix arg:
| | * No prefix arg: all buffers
| * Numeric arg > 0: buffers visiting files or directories (Dired)
| * Numeric arg < 0: buffers associated with the selected frame
| * Numeric arg = 0: buffers with the same mode as the current buffer
| * Plain prefix arg (`C-u'): buffers with the same mode as current, or
| with a mode that the current mode is derived from
| | For Emacs 23 and later, the default values (via `M-n') are the
| (buffer-name components of the) first four completion candidates
| (respecting the prefix argument).
| | You can use these additional keys during completion:
| | * `C-x m' Visit a bookmarked buffer (only if you use Bookmark+).
| * `C-x C-m -' Remove candidate buffers whose mode is derived from a
| given mode. Repeatable. (`C-m' = `RET'.)
| * `C-x M -' Remove buffers in a given mode. Repeatable.
| * `C-x C-m +' Keep only buffers in a mode derived from a given mode.
| * `C-x M +' Keep only buffers in a given mode.
| * `S-delete' Kill the buffer named by a completion candidate.
| | These options, when non-nil, control candidate matching and filtering:
| | `icicle-buffer-ignore-space-prefix-flag' - Ignore space-prefix names
| `icicle-buffer-extras' - Extra buffers to display
| `icicle-buffer-match-regexp' - Regexp that buffers must match
| `icicle-buffer-no-match-regexp' - Regexp buffers must not match
| `icicle-buffer-predicate' - Predicate buffer names satisfy
| `icicle-buffer-sort' - Sort function for candidates
| | For example, to show only buffers that are associated with files, set
| `icicle-buffer-predicate' to (lambda (buf) (buffer-file-name buf)).
| | Option `icicle-buffer-require-match-flag' can be used to override
| option `icicle-require-match-flag'.
| | Option `icicle-buffers-ido-like' non-nil gives this command a more
| Ido-like behavior.
| | See also command `icicle-buffer-no-search', which is `icicle-buffer'
| without the multi-completion behavior that searches buffer content.
| | See also command `icicle-buffer-config', which lets you choose a
| configuration of user options for commands such as `icicle-buffer'.
| | Note: The prefix arg is tested, even when this is called
| noninteractively. Lisp code can bind `current-prefix-arg' to control
| the behavior.
| | Read input, then call `switch-to-buffer' to act on it.
| | Input-candidate completion and cycling are available. While cycling,
| these keys with prefix `C-' are active:
| | `C-mouse-2', `C-return' - Act on current completion candidate only
| `C-down', `C-wheel-down' - Move to next completion candidate and act
| `C-up', `C-wheel-up' - Move to previous completion candidate and act
| `C-next' - Move to next apropos-completion candidate and act
| `C-prior' - Move to previous apropos-completion candidate and act
| `C-end' - Move to next prefix-completion candidate and act
| `C-home' - Move to previous prefix-completion candidate and act
| `C-!' - Act on *all* candidates, successively (careful!)
| | When candidate action and cycling are combined (e.g. `C-next'), user
| option `icicle-act-before-cycle-flag' determines which occurs first.
| | With prefix `C-M-' instead of `C-', the same keys (`C-M-mouse-2',
| `C-M-RET', `C-M-down', and so on) provide help about candidates.
| | Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or
| `C-g' to quit.
What that does not mention is that you can also sort buffer candidates in
multiple ways on the fly (cycle sort orders with `C-,'), which can be helpful
when cycling among them. This includes sorting by:
. last access
. major-mode name
. mode-line major-mode name
. file name or process name
. previous use alphabetically
. last use as input
. alphabetical by content-part match
(the multi-completion second part)
> Is there an equivalent for the menu from the menu bar? And is
> there a way to change the sort order?
Je ne sais pas. The help-mode documentation on mouse-buffer-menu-mode-mult and on mouse-buffer-menu-mode-groups suggests that it only works for the pop-up menu. The latter variable suggests that some other sort order is possible. The fact that these variables are coming from mouse.el makes this quite certain.
Did you read the documentation on the Buffers menu? (I'm not using that menu, it can be longer than the screen's height…) A bit of sorting could certainly suit it.
_o o o o
_<< \\_/\_, \\_ \\_/\_,
(*)/(*) (*) (*) (*) `- (*)
Peter Dyballa wrote:
> Am 05.10.2012 um 20:18 schrieb Jérôme M. Berger:
>> Is there an equivalent for the menu from the menu bar? And is
>> there a way to change the sort order?
> Je ne sais pas. The help-mode documentation on
> mouse-buffer-menu-mode-mult and on mouse-buffer-menu-mode-groups
> suggests that it only works for the pop-up menu. The latter variable
> suggests that some other sort order is possible. The fact that these
> variables are coming from mouse.el makes this quite certain.
I tried playing with those variables, and they do only affect the
pop-up menu (logical given their names).
> Did you read the documentation on the Buffers menu? (I'm not
> using that menu, it can be longer than the screen's height…) A bit of
> sorting could certainly suit it.
Thanks, unfortunately I've been unable to find any documentation
about the buffer menu. What is called "Buffer menu" in the
documentation is actually the buffer list (i.e. the buffer that you
get with C-x C-b that displays a list of buffers). There is no
mention of the menubar anywhere I could find.