From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Looking for a buffer-cycling library Date: Sat, 15 Nov 2014 09:17:00 -0800 (PST) Message-ID: <8ed4206d-52b3-4b6c-9da4-9397ed95fa68@default> References: <87bno8tsps.fsf@wmi.amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1416071862 8004 80.91.229.3 (15 Nov 2014 17:17:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 17:17:42 +0000 (UTC) To: Marcin Borkowski , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 15 18:17:35 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xpgya-0004wV-RV for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 18:17:33 +0100 Original-Received: from localhost ([::1]:41355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xpgya-0003H5-38 for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 12:17:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpgyG-0003Gv-07 for help-gnu-emacs@gnu.org; Sat, 15 Nov 2014 12:17:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xpgy7-00035d-8p for help-gnu-emacs@gnu.org; Sat, 15 Nov 2014 12:17:11 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:42753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xpgy7-00035T-19 for help-gnu-emacs@gnu.org; Sat, 15 Nov 2014 12:17:03 -0500 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id sAFHH1S1002321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 15 Nov 2014 17:17:02 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id sAFHGxd6000740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 15 Nov 2014 17:17:00 GMT Original-Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id sAFHGxGA018007; Sat, 15 Nov 2014 17:16:59 GMT In-Reply-To: <87bno8tsps.fsf@wmi.amu.edu.pl> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100934 Archived-At: > >> 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" >=20 > 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'. |=20 | It is bound to menu-bar buffer Icicles icicle-buffer, C-x b, menu-bar | buffer select-named-buffer. |=20 | (icicle-buffer) |=20 | 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'. |=20 | 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). |=20 | 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. |=20 | 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. |=20 | 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'. |=20 | 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. |=20 | For example: |=20 | 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'. |=20 | 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. |=20 | This is a buffer-switching command. If you instead want to navigate | to text searched for in buffers then use `icicle-search'. |=20 | The buffer-name portion of completion candidates is as follows, | depending on the prefix arg: |=20 | * 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 =3D 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 |=20 | Those are the default prefix-argument behaviors, but you can change | them using option `icicle-buffer-prefix-arg-filtering'. |=20 | 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). |=20 | You can use these additional keys during completion: |=20 | * `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' =3D `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). | * `' Kill the buffer named by a completion candidate. |=20 | Those are default key bindings, but you can change them using option | `icicle-buffer-candidate-key-bindings'. |=20 | These options, when non-nil, control candidate matching and filtering: |=20 | `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 |=20 | For example, to change the default behavior to show only buffers that | are associated with files, set `icicle-buffer-predicate' to this: |=20 | (lambda (bufname) (buffer-file-name (get-buffer bufname))) |=20 | Option `icicle-buffer-require-match-flag' can be used to override | option `icicle-require-match-flag'. |=20 | Option `icicle-buffers-ido-like' non-nil gives this command a more | Ido-like behavior. |=20 | See also command `icicle-buffer-no-search', which is `icicle-buffer' | without the multi-completion behavior that searches buffer content. |=20 | See also command `icicle-buffer-config', which lets you choose a | configuration of user options for commands such as `icicle-buffer'. |=20 | Note: The prefix arg is tested, even when this is called | noninteractively. Lisp code can bind `current-prefix-arg' to control | the behavior. |=20 | Read input, then act on it. |=20 | Input-candidate completion and cycling are available. While cycling, | these keys with prefix `C-' are active: |=20 | `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!) |=20 | When candidate action and cycling are combined (e.g. `C-next'), user | option `icicle-act-before-cycle-flag' determines which occurs first. |=20 | 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. |=20 | Use `mouse-2', `RET', or `S-RET' to finally choose a candidate, or | `C-g' to quit. |=20 | This is an Icicles command - see command `icicle-mode'. `----