unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* list-buffers by buffer type
@ 2012-10-05  5:50 drain
  2012-10-05  6:28 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: drain @ 2012-10-05  5:50 UTC (permalink / raw)
  To: Help-gnu-emacs

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.



--
View this message in context: http://emacs.1067599.n5.nabble.com/list-buffers-by-buffer-type-tp266237.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: list-buffers by buffer type
  2012-10-05  5:50 list-buffers by buffer type drain
@ 2012-10-05  6:28 ` Drew Adams
  2012-10-05  8:51 ` Peter Dyballa
  2012-10-05  9:17 ` Jambunathan K
  2 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2012-10-05  6:28 UTC (permalink / raw)
  To: 'drain', Help-gnu-emacs

> 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.

http://www.emacswiki.org/cgi-bin/wiki/Icicles


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
| candidates.
| 
| 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
. size
. 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)

HTH.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list-buffers by buffer type
  2012-10-05  5:50 list-buffers by buffer type drain
  2012-10-05  6:28 ` Drew Adams
@ 2012-10-05  8:51 ` Peter Dyballa
  2012-10-05 18:18   ` "Jérôme M. Berger"
  2012-10-05  9:17 ` Jambunathan K
  2 siblings, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2012-10-05  8:51 UTC (permalink / raw)
  To: drain; +Cc: Help-gnu-emacs


Am 05.10.2012 um 07:50 schrieb drain:

> 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.

Have you tried setting mouse-buffer-menu-mode-mult?

--
Greetings

  Pete

Almost anything is easier to get into than out of.
				– Allen's Law




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list-buffers by buffer type
  2012-10-05  5:50 list-buffers by buffer type drain
  2012-10-05  6:28 ` Drew Adams
  2012-10-05  8:51 ` Peter Dyballa
@ 2012-10-05  9:17 ` Jambunathan K
  2 siblings, 0 replies; 9+ messages in thread
From: Jambunathan K @ 2012-10-05  9:17 UTC (permalink / raw)
  To: drain; +Cc: Help-gnu-emacs

drain <aeuster@gmail.com> writes:

> 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.

I have C-x C-b bound to ibuffer.  You can sort the buffer list based on
mode and kill or switch to them.

Another option is to use ido-mode - i.e., I have C-x b getting routed to
ido-switch-buffer.  Type in .org to narrow to buffers that have given
extension and major mode.

>
>
>
> --
> View this message in context: http://emacs.1067599.n5.nabble.com/list-buffers-by-buffer-type-tp266237.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
>
>

-- 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list-buffers by buffer type
  2012-10-05  8:51 ` Peter Dyballa
@ 2012-10-05 18:18   ` "Jérôme M. Berger"
  2012-10-05 20:05     ` Peter Dyballa
  0 siblings, 1 reply; 9+ messages in thread
From: "Jérôme M. Berger" @ 2012-10-05 18:18 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

Peter Dyballa wrote:
> Am 05.10.2012 um 07:50 schrieb drain:
> 
>> 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.
> 
> Have you tried setting mouse-buffer-menu-mode-mult?
> 
	Nice! Is there an equivalent for the menu from the menu bar? And is
there a way to change the sort order?

	Thanks,
		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list-buffers by buffer type
  2012-10-05 18:18   ` "Jérôme M. Berger"
@ 2012-10-05 20:05     ` Peter Dyballa
  2012-10-07  8:29       ` "Jérôme M. Berger"
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2012-10-05 20:05 UTC (permalink / raw)
  To: "Jérôme M. Berger"; +Cc: help-gnu-emacs


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.

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.

--
Greetings

  Pete

     _o    o         o   o
   _<<     \\_/\_,   \\_ \\_/\_,
  (*)/(*) (*)   (*) (*) `-    (*)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list-buffers by buffer type
  2012-10-05 20:05     ` Peter Dyballa
@ 2012-10-07  8:29       ` "Jérôme M. Berger"
  2012-10-08 21:29         ` Peter Dyballa
  0 siblings, 1 reply; 9+ messages in thread
From: "Jérôme M. Berger" @ 2012-10-07  8:29 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

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.

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list-buffers by buffer type
  2012-10-07  8:29       ` "Jérôme M. Berger"
@ 2012-10-08 21:29         ` Peter Dyballa
  2012-10-09 20:14           ` "Jérôme M. Berger"
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2012-10-08 21:29 UTC (permalink / raw)
  To: Jérôme M. Berger; +Cc: help-gnu-emacs


Am 07.10.2012 um 10:29 schrieb Jérôme M. Berger:

> Thanks, unfortunately I've been unable to find any documentation
> about the buffer menu.

I had a look into menu-bar.el. There are functions like menu-bar-update-buffers and menu-bar-update-buffers-1 which look like being open for enhancements…

I found that file by entering C-h k and then choosing a buffer from the Buffers menu.

--
Greetings

  Pete

We also sponsor National Invisible Chronic Illness Awareness Week annually in September.
Join the millions!




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: list-buffers by buffer type
  2012-10-08 21:29         ` Peter Dyballa
@ 2012-10-09 20:14           ` "Jérôme M. Berger"
  0 siblings, 0 replies; 9+ messages in thread
From: "Jérôme M. Berger" @ 2012-10-09 20:14 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]

Peter Dyballa wrote:
> Am 07.10.2012 um 10:29 schrieb Jérôme M. Berger:
> 
>> Thanks, unfortunately I've been unable to find any documentation
>> about the buffer menu.
> 
> I had a look into menu-bar.el. There are functions like menu-bar-update-buffers and menu-bar-update-buffers-1 which look like being open for enhancements…
> 
	Thanks, I'll have a look there.

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-10-09 20:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05  5:50 list-buffers by buffer type drain
2012-10-05  6:28 ` Drew Adams
2012-10-05  8:51 ` Peter Dyballa
2012-10-05 18:18   ` "Jérôme M. Berger"
2012-10-05 20:05     ` Peter Dyballa
2012-10-07  8:29       ` "Jérôme M. Berger"
2012-10-08 21:29         ` Peter Dyballa
2012-10-09 20:14           ` "Jérôme M. Berger"
2012-10-05  9:17 ` Jambunathan K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).