all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: suvayu ali <fatkasuvayu+linux@gmail.com>
To: Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Filtering files in dired while invoking
Date: Mon, 30 Aug 2010 16:40:45 -0700	[thread overview]
Message-ID: <AANLkTi=_2QBNXDSm8+nGO_jndQLcQZ_Wg4JukP1vvL7q@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=FkTuuj8U358Sr6_tHUsEK+6yCPoHB32nL6bK_@mail.gmail.com>

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.



  parent reply	other threads:[~2010-08-30 23:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30 19:26 Filtering files in dired while invoking suvayu ali
2010-08-30 20:19 ` Drew Adams
2010-08-30 23:40 ` suvayu ali [this message]
2010-08-31  6:10   ` Drew Adams
2010-08-31  6:18     ` OT (was: Filtering files in dired while invoking) Drew Adams
2010-09-27  1:33     ` Filtering files in dired while invoking Drew Adams
2010-08-31 12:17 ` Lei Wang
2010-08-31 17:40   ` suvayu ali
     [not found] <AANLkTi=3DFkTuuj8U358Sr6_tHUsEK+6yCPoHB32nL6bK_@mail.gmail.com>
2010-08-31 15:28 ` Ehud Karni
2010-08-31 17:33   ` suvayu ali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=_2QBNXDSm8+nGO_jndQLcQZ_Wg4JukP1vvL7q@mail.gmail.com' \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.