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: Quickly Viewing Files in a File List, and then Quickly Closing Date: Fri, 18 Oct 2013 09:55:27 -0700 (PDT) Message-ID: References: <70b8bb7d-6e1a-418d-af12-c122119094e5@default> 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 1382115362 18358 80.91.229.3 (18 Oct 2013 16:56:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Oct 2013 16:56:02 +0000 (UTC) To: Eric Brown , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 18 18:56:03 2013 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 1VXDLG-00052a-Pf for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Oct 2013 18:56:02 +0200 Original-Received: from localhost ([::1]:58776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXDLG-00055h-G8 for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Oct 2013 12:56:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXDKt-00053N-Lx for help-gnu-emacs@gnu.org; Fri, 18 Oct 2013 12:55:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXDKl-0004Qu-1N for help-gnu-emacs@gnu.org; Fri, 18 Oct 2013 12:55:39 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:44668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXDKk-0004Qp-QJ for help-gnu-emacs@gnu.org; Fri, 18 Oct 2013 12:55:30 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r9IGtSRW001485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Oct 2013 16:55:29 GMT Original-Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9IGtRAj019004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Oct 2013 16:55:28 GMT Original-Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9IGtRUv017094; Fri, 18 Oct 2013 16:55:27 GMT In-Reply-To: <70b8bb7d-6e1a-418d-af12-c122119094e5@default> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 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:94087 Archived-At: > If you hold down `Control' while doing that (i.e., `C-down') then > you act on each file in turn. (You can use `C-RET' to act on a file > that you have cycled to using just `up' or `down'.) ... > You could easily define a command that would do that, say putting > the `kill-buffer' action on a timer or associating it with an event > (e.g. visiting the next file). Here is a quick command definition that does that. It lets you use the Icicles alternate action keys, `C-S-RET', `C-S-down', etc., which are analogous to the main action keys, `C-RET', `C-down', etc. (which visit the candidate), to visit the candidate in `view-mode' and at the same time kill the buffer of the last such visited candidate. (defun my-find-file () "Like `icicle-find-file', but alt action views file temporarily. Alternate action keys such as `C-S-down' visit the candidate file in `view-mode' and kill the buffer of the last such viewed candidate." (interactive) (let ((icicle-candidate-alt-action-fn (lambda (file) (when (and my-last-viewed (get-file-buffer my-last-viewed)) (kill-buffer (get-file-buffer my-last-viewed))) (setq my-last-viewed (abbreviate-file-name file)) (view-file file) (select-frame-set-input-focus =09 (window-frame (active-minibuffer-window)))))) (icicle-find-file-of-content))) (defvar my-last-viewed nil "Last file viewed by alternate action of `my-find-file'.") So you would: 1. Use `M-x my-find-file' (or bind it to a key - e.g., `C-x C-f'). 2. Optionally type part of a file name, to limit the matching names. 3. Optionally use `down' or `up' to cycle among file names. 4. Use `C-S-down' to visit the next file in order. 5. Repeat #4 to see other files in order. 6. Repeat #2 or #3 to see other sets of files. 7. End with `RET' to choose a file to visit or `C-g' to cancel. Each file buffer you visited with `C-S-down' was killed when you viewed the next one. You can also mix in `C-down' or `C-RET' to also visit files whose buffers you do not want to kill automatically. (Change `view-file' to `find-file' if you don't want to visit in `view-mode', which is read-only.) [By default, the alternate action for `icicle-find-file' is `icicle-alt-act-fn-for-type', which prompts you for a file- appropriate action to use on the particular candidate chosen for the action. Command `my-find-file' just substitutes a different alternate action function (for all candidates you choose).]