From: Drew Adams <drew.adams@oracle.com>
To: Marcin Borkowski <mbork@wmi.amu.edu.pl>, help-gnu-emacs@gnu.org
Subject: RE: Looking for a buffer-cycling library
Date: Sat, 15 Nov 2014 09:17:00 -0800 (PST) [thread overview]
Message-ID: <8ed4206d-52b3-4b6c-9da4-9397ed95fa68@default> (raw)
In-Reply-To: <87bno8tsps.fsf@wmi.amu.edu.pl>
> >> I'm looking for a buffer cycling mechanism that will ignore
> >> any buffer not loaded from or written to a file. Example -
> >> any buffer whose name begins with '*' would be "jumped over"
>
> Just my 2 cents: why not use Icicles?
Icicles does let you "ignore any buffer not loaded from or
written to a file".
To do that, just use a positive prefix arg with `icicle-buffer':
`M-1 C-x b'. That limits the candidates to names of buffers
visiting files & directories.
(Or define your own command that binds `current-prefix-arg' to
a positive integer and invokes `icicle-buffer'.)
You can also exclude or include particular buffer names using
these user options (customize them or bind them in your own
commands):
`icicle-buffer-match-regexp' - Regexp buffer names must match
`icicle-buffer-no-match-regexp' - Regexp names must not match
`icicle-buffer-predicate' - Predicate names must satisfy
`icicle-buffer-extras' - Extra buffer names to display
For example, to change the default behavior to show only buffers
associated with files (so no need to use a prefix arg, and exclude
also directories), set `icicle-buffer-predicate' to this:
(lambda (bf) (buffer-file-name bf))
However, the OP also wants to use terminal mode. Icicles can be
used in terminal mode, but it no doubt calls for customizing some
minibuffer key bindings, as some of the default bindings are for
keys that terminals do not support. (I don't use terminal mode
anymore, and I don't make much effort to support it for Icicles,
but I do know that some people use Icicles with terminal mode.)
---
Here is the (long) doc for command `icicle-buffer' (`C-x b' in
Icicle mode, by default):
,----
| icicle-buffer is an interactive Lisp function in `icicles-cmd1.el'.
|
| It is bound to menu-bar buffer Icicles icicle-buffer, C-x b, menu-bar
| buffer select-named-buffer.
|
| (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.
|
| When matching buffer content, Icicles just looks for a single match.
| Visiting the buffer does not move to that match or to any other match.
| Matching is used only to filter candidate buffers.
|
| However, if your input includes a content-matching part and it
| matches, that part is automatically added to the Isearch regexp
| history, `regexp-search-ring' whenever you hit `S-TAB' to complete.
| This means that when you visit the buffer you can immediately search
| for matches using `C-M-s' or `C-M-r'.
|
| 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
| * Double plain (`C-u C-u'): visible buffers (possibly iconified)
| * Triple plain (`C-u C-u C-u'): invisible buffers
|
| Those are the default prefix-argument behaviors, but you can change
| them using option `icicle-buffer-prefix-arg-filtering'.
|
| 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 F' Toggle including cached file names as candidates (option
| `icicle-buffer-include-cached-files-nflag').
| * `C-x R' Toggle including recent file names as candidates (option
| `icicle-buffer-include-recent-files-nflag').
| * `C-x m' Visit a bookmarked buffer (only if you use Bookmark+).
| * `C-x M -' Remove buffers in a given mode. Repeatable.
| * `C-x M +' Keep only buffers in a given mode.
| * `C-x C-m -' Remove candidate buffers whose mode is derived from a
| given mode. Repeatable. (`C-m' = `RET'.)
| * `C-x C-m +' Keep only buffers in a mode derived from a given mode.
| * `C-x v -' Remove buffers that are visible (maybe iconified).
| * `C-x v +' Keep only buffers that are visible (maybe iconified).
| * `<S-delete>' Kill the buffer named by a completion candidate.
|
| Those are default key bindings, but you can change them using option
| `icicle-buffer-candidate-key-bindings'.
|
| These options, when non-nil, control candidate matching and filtering:
|
| `icicle-buffer-extras' - Extra buffer names to display
| `icicle-buffer-ignore-space-prefix-flag' - Ignore space-prefix names
| `icicle-buffer-include-cached-files-nflag' - Include cached files
| `icicle-buffer-include-recent-files-nflag' - Include recent files
| `icicle-buffer-match-regexp' - Regexp buffer names must match
| `icicle-buffer-no-match-regexp' - Regexp names must not match
| `icicle-buffer-predicate' - Predicate names must satisfy
| `icicle-buffer-sort' - Sort function for candidates
| `icicle-buffer-skip-functions' - Exclude from content searching
| `icicle-file-skip-functions' - Same, but cached/recent files
|
| For example, to change the default behavior to show only buffers that
| are associated with files, set `icicle-buffer-predicate' to this:
|
| (lambda (bufname) (buffer-file-name (get-buffer bufname)))
|
| 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 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.
|
| This is an Icicles command - see command `icicle-mode'.
`----
next prev parent reply other threads:[~2014-11-15 17:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.13706.1416006724.1147.help-gnu-emacs@gnu.org>
2014-11-15 11:31 ` Looking for a buffer-cycling library Joost Kremers
2014-11-15 14:59 ` Marcin Borkowski
2014-11-15 17:17 ` Drew Adams [this message]
2014-11-15 21:04 ` Marcin Borkowski
2014-11-15 23:41 ` Drew Adams
[not found] ` <mailman.13736.1416063601.1147.help-gnu-emacs@gnu.org>
2014-11-16 10:15 ` Joost Kremers
[not found] ` <<slrnm6guar.a37.joost.m.kremers@j.kremers4.news.arnhem.chello.nl>
2014-11-16 17:08 ` Drew Adams
2014-11-16 18:01 ` Marcin Borkowski
2014-11-16 20:18 ` Drew Adams
2014-11-14 23:11 Tim Johnson
2014-11-15 1:34 ` Alexis
2014-11-15 3:32 ` Tim Johnson
2014-11-15 3:56 ` Alexis
2014-11-15 16:44 ` Tim Johnson
2014-11-15 17:19 ` Drew Adams
2014-11-15 20:32 ` Tim Johnson
2014-11-15 20:38 ` Drew Adams
2014-11-15 22:29 ` Tim Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ed4206d-52b3-4b6c-9da4-9397ed95fa68@default \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=mbork@wmi.amu.edu.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).