From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: suvayu ali Newsgroups: gmane.emacs.help Subject: Re: Filtering files in dired while invoking Date: Mon, 30 Aug 2010 16:40:45 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1283211699 31086 80.91.229.12 (30 Aug 2010 23:41:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 30 Aug 2010 23:41:39 +0000 (UTC) To: Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 31 01:41:36 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 1OqDyo-0004Sh-NC for geh-help-gnu-emacs@m.gmane.org; Tue, 31 Aug 2010 01:41:35 +0200 Original-Received: from localhost ([127.0.0.1]:40342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqDyn-0006HI-Vg for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Aug 2010 19:41:34 -0400 Original-Received: from [140.186.70.92] (port=56560 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqDyN-0006HD-Tb for help-gnu-emacs@gnu.org; Mon, 30 Aug 2010 19:41:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqDyM-0004Bt-Ch for help-gnu-emacs@gnu.org; Mon, 30 Aug 2010 19:41:07 -0400 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:53093) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqDyM-0004Bm-6g for help-gnu-emacs@gnu.org; Mon, 30 Aug 2010 19:41:06 -0400 Original-Received: by wyb36 with SMTP id 36so8730342wyb.0 for ; Mon, 30 Aug 2010 16:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:content-type; bh=Bq5+u0/jebqeWBNMn4fVJV3Gp2Wl6BpmzZAMznXHsv8=; b=lSZ9KCacdPwnbnolIxTplhD5idr1kKNxJ6a51nilWmS5WqqyGRvXryIJ4Kn7x5hlgB tr0uUkrL2F4IQx6nG4zXDNeqWKqag+HJrSEznBvvKGKnz+WgvkkXKsmJ23svsdpuYxG0 k/UTv9rBzfVdVgUrTUcFsODpB2cGTC9Mrt164= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=W5sr/3Wa1nWu4EcuW8ji5NAUsv4LbLigjXu4VC7ijixFbFoBWFGCoIt6DWSTkpCThO thcKrt4vCqvKtAcldJ9Fnob5LKz6xEOCNN5XZUlx4C7FXIViYP/cAgF2ZBrQxOjy3eXN 5U+TfJ5hXbk+CXqyIER2F7Raxjhcemmq+gsw0= Original-Received: by 10.216.175.83 with SMTP id y61mr5592996wel.30.1283211665190; Mon, 30 Aug 2010 16:41:05 -0700 (PDT) Original-Received: by 10.216.192.168 with HTTP; Mon, 30 Aug 2010 16:40:45 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: aEjB7blb2keim5NQRBuh7FKKMxE X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:74838 Archived-At: Hi Drew, > > 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. Thank you, don't know why this didn't strike me as a solution. :) > > 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). > I had a hunch that would be the case. I think I'll try my hand at writing a function like that. Thank you for outlining the basic idea. :) Maybe I can defadvice `dired' to run my function when ever there is a space separated argument, and call regular dired otherwise? > 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. > I was actually doing something similar for now, I was marking the files, toggling the marks and then killing the lines with `k'. > 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 These sound very neat. I had actually tried out icicles at some point, but I was a too much of a beginner back then and was rather overwhelmed. :-p I will give those another shot. Thanks for the wonderful suggestions. :) PS: I have noticed this before, for some reason most of your replies don't arrive in my mailbox and I end up reading them from the archive! And since the "reply-to" button in the archive is broken, I have to copy paste your response inside my response. My reply will probably show up in the wrong place of the thread. Probably some problem at my end, Oh well :-/ -- Suvayu Open source is the future. It sets us free.