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: Filtering files in dired while invoking Date: Mon, 30 Aug 2010 13:19:45 -0700 Message-ID: References: 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 1283199915 18832 80.91.229.12 (30 Aug 2010 20:25:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 30 Aug 2010 20:25:15 +0000 (UTC) To: "'suvayu ali'" , "'Emacs mailing list'" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 30 22:25:12 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 1OqAuj-0000Y7-TR for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Aug 2010 22:25:10 +0200 Original-Received: from localhost ([127.0.0.1]:57576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqAqQ-0003RP-64 for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Aug 2010 16:20:42 -0400 Original-Received: from [140.186.70.92] (port=50840 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqApk-0003OE-DC for help-gnu-emacs@gnu.org; Mon, 30 Aug 2010 16:20:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqApi-00058y-QO for help-gnu-emacs@gnu.org; Mon, 30 Aug 2010 16:20:00 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:18293) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqApi-00057q-Bb for help-gnu-emacs@gnu.org; Mon, 30 Aug 2010 16:19:58 -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 o7UKJtC6000669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 30 Aug 2010 20:19:56 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o7UAff9U018412 for ; Mon, 30 Aug 2010 20:19:54 GMT Original-Received: from abhmt003.oracle.com by acsmt354.oracle.com with ESMTP id 546048371283199585; Mon, 30 Aug 2010 13:19:45 -0700 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 30 Aug 2010 13:19:45 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: ActIeZupwlIQNJ7vQs6RG0/1xXEIzwAA/gyw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 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:74837 Archived-At: > I was trying to filter the files listed in a dired buffer. Filtering > with one shell glob works fine, but how do I pass multiple shell globs > to dired? > > What I 'm looking for is to list files as they would be listed by, > > $ ls -l *.C *.h *.cxx `C-x d *.[Chc]*' gets you part-way there. > I couldn't find any reference to this in the info manual. But the > docstring for dired says this, > > (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. > ..... > > How can I achieve that? Thanks for any suggestions. The command `dired' does not let you do that. Its `interactive' spec just reads a file (directory) name, possibly with wildcards. But function `dired' does let you do that if you call it from Lisp - you just need to pass it an explicit list of file names in place of the directory name. So you could write your own command to do what you want. The `interactive' spec would, e.g., read file names (possibly with wildcards) until you enter an empty name ("") - it would return a list of the names entered. The body of the function would just call `dired', passing the list (with a (pseudo-)directory name prepended to the file names). However, you can often do what you want to do using marking or omitting instead. See `dired-omit-mode' in dired-x.el, for example. If you use Dired+, then you can combine marking and omitting - omit all of the marked or unmarked files, for instance. Marking files is the single most useful thing you can do in Dired. You can mark files that match a regexp (`%m'), and so on. And you can of course mark some files matching one pattern and then mark some more by matching another pattern. With one or more 3rd-party features you can also bookmark or save a Dired listing persistently, so you don't have to remark files from scratch each time. These links might help: http://www.emacswiki.org/emacs/DiredPlus http://www.emacswiki.org/emacs/BookmarkPlus http://www.emacswiki.org/emacs/Icicles_-_Dired_Enhancements http://www.emacswiki.org/emacs/CategoryDirectories