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: Simple useful function Date: Mon, 5 Jul 2010 16:34:05 -0700 Message-ID: References: <87vd8tk026.fsf@stats.ox.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1278372929 899 80.91.229.12 (5 Jul 2010 23:35:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 5 Jul 2010 23:35:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, 'Andrea Crotti' To: "'Dan Davison'" , "'Deniz Dogan'" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 06 01:35:27 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OVvCB-000574-0c for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Jul 2010 01:35:27 +0200 Original-Received: from localhost ([127.0.0.1]:48472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVvCA-0006nK-Hw for geh-help-gnu-emacs@m.gmane.org; Mon, 05 Jul 2010 19:35:26 -0400 Original-Received: from [140.186.70.92] (port=57896 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVvBm-0006nA-1F for help-gnu-emacs@gnu.org; Mon, 05 Jul 2010 19:35:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OVvBk-00020D-Ti for help-gnu-emacs@gnu.org; Mon, 05 Jul 2010 19:35:01 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:48264) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVvBk-0001zl-OH for help-gnu-emacs@gnu.org; Mon, 05 Jul 2010 19:35:00 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o65NYuva018473 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Jul 2010 23:34:58 GMT Original-Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o65IQlos029477; Mon, 5 Jul 2010 23:34:55 GMT Original-Received: from abhmt010.oracle.com by acsmt355.oracle.com with ESMTP id 399295381278372841; Mon, 05 Jul 2010 16:34:01 -0700 Original-Received: from dradamslap1 (/141.144.80.58) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Jul 2010 16:34:01 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87vd8tk026.fsf@stats.ox.ac.uk> Thread-Index: Acscla5KdUGVdtLZTjyK6xip4zVNeQAAJCsg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Source-IP: acsmt355.oracle.com [141.146.40.155] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090207.4C326C20.00E4:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74085 Archived-At: > Is there a way to do this sort of stuff with dired (perhaps involving > magit)? E.g. how would one limit dired to showing just the files that > git is tracking? If you have an Emacs function that returns those file names (absolute or relative), then you can open a Dired buffer for just those files. You do that by calling `dired' with a cons arg: the list of file names. If the files are not all in the same directory, then use absolute names. For example: (dired "My GIT Files" '("/my/first/file" "/my/2nd/file"...)) `C-h f dired': ,---- | dired is an interactive compiled Lisp function in `dired.el'. ... | (dired DIRNAME &optional SWITCHES) ... | If DIRNAME is a cons, its first element is taken as the directory name | and the rest as an explicit list of files to make directory entries for. | You can move around in it with the usual commands. ... `---- You can do more than "move around in it"! All Dired operations work normally on the files listed. The file names can be a mix of local and remote, absolute and relative. This is an important and little known Dired feature. IMHO, it is not well documented. And that's probably why it had a few bugs wrt remote files until this year. Little attention is drawn to this feature, yet it is very useful. You can use it to organize files into projects etc. Define specific commands that give you just the sets of files you want. Combine this feature with an ability to bookmark Dired buffers and you have a flexible way to get quickly to and operate on a given set of files, without defining specialized commands. With Bookmark+, you can not only bookmark an arbitrary Dired buffer (saving the current Dired switches, markings, and subdir showings). You can also open a Dired buffer on the bookmarks currently marked in the `*Bookmark List*'. http://www.emacswiki.org/emacs/BookmarkPlus