all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Dired and wildcards
@ 2007-06-19  7:43 Eli Zaretskii
  2007-06-19  8:40 ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2007-06-19  7:43 UTC (permalink / raw)
  To: emacs-devel

Suppose you have a directory named "foo[bar]".  From a Bash prompt,
"ls foo[bar]" will show the contents of that directory, unless there
are files that match the wildcard "foo[bar]".  If there are such
files, `ls' shows me those files, not the directory.  This is
expected, given the way Bash handles wildcards.

But from Emacs on GNU/Linux, "C-x d foo[bar] RET" _always_ shows the
contents of the directory foo[bar].  Is there any way to tell Dired
that the argument is a wildcard, not a literal file name?  What am I
missing?

TIA

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Dired and wildcards
  2007-06-19  7:43 Dired and wildcards Eli Zaretskii
@ 2007-06-19  8:40 ` Andreas Schwab
  2007-06-19 15:17   ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2007-06-19  8:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> But from Emacs on GNU/Linux, "C-x d foo[bar] RET" _always_ shows the
> contents of the directory foo[bar].  Is there any way to tell Dired
> that the argument is a wildcard, not a literal file name?  What am I
> missing?

I'm not sure I understand your question.  In which way is this different
from the situation in the shell?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Dired and wildcards
  2007-06-19  8:40 ` Andreas Schwab
@ 2007-06-19 15:17   ` Eli Zaretskii
  2007-06-19 15:30     ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2007-06-19 15:17 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

> From: Andreas Schwab <schwab@suse.de>
> Cc: emacs-devel@gnu.org
> Date: Tue, 19 Jun 2007 10:40:10 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > But from Emacs on GNU/Linux, "C-x d foo[bar] RET" _always_ shows the
> > contents of the directory foo[bar].  Is there any way to tell Dired
> > that the argument is a wildcard, not a literal file name?  What am I
> > missing?
> 
> I'm not sure I understand your question.  In which way is this different
> from the situation in the shell?

At the shell prompt, if there are files that match the shell wildcard
"foo[bar]" (e.g., fooa and foob), `ls' will show them, even though I
have a _subdirectory_ foo[bar] in the sane directory; but in Emacs, I
always get the directory foo[bar], never the files fooa and foob.

Here's a precise recipe:

Outside Emacs: $ mkdir "foo[bar]"; touch "foo[bar]"/{foo,bar}; touch foo{a,b}
Inside Emacs: C-x d foo[bar] RET

Interestingly enough, "C-x d foo*" shows the files fooa and foob.  Why
"foo*" is interpreted by Dired as a wildcard, while "foo[bar]" is not?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Dired and wildcards
  2007-06-19 15:17   ` Eli Zaretskii
@ 2007-06-19 15:30     ` Andreas Schwab
  2007-06-19 16:17       ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2007-06-19 15:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Interestingly enough, "C-x d foo*" shows the files fooa and foob.  Why
> "foo*" is interpreted by Dired as a wildcard, while "foo[bar]" is not?

Because "foo*" does not exist.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Dired and wildcards
  2007-06-19 15:30     ` Andreas Schwab
@ 2007-06-19 16:17       ` Eli Zaretskii
  2007-06-19 16:51         ` Andreas Schwab
  2007-06-19 17:53         ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2007-06-19 16:17 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

> From: Andreas Schwab <schwab@suse.de>
> Cc: emacs-devel@gnu.org
> Date: Tue, 19 Jun 2007 17:30:47 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Interestingly enough, "C-x d foo*" shows the files fooa and foob.  Why
> > "foo*" is interpreted by Dired as a wildcard, while "foo[bar]" is not?
> 
> Because "foo*" does not exist.

And now to my original question: is there a way to tell Dired to
interpret "foo[bar]" as a wildcard, even though a file by that literal
name exists?  You seem to say there is no way, but I'm not sure I
understand you correctly.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Dired and wildcards
  2007-06-19 16:17       ` Eli Zaretskii
@ 2007-06-19 16:51         ` Andreas Schwab
  2007-06-19 19:41           ` Eli Zaretskii
  2007-06-19 17:53         ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2007-06-19 16:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> And now to my original question: is there a way to tell Dired to
> interpret "foo[bar]" as a wildcard, even though a file by that literal
> name exists?  You seem to say there is no way, but I'm not sure I
> understand you correctly.

An existing directory is always preferred, see dired-noselect:

    ;; If the argument was syntactically  a directory name not a file name,
    ;; or if it happens to name a file that is a directory,
    ;; convert it syntactically to a directory name.
    ;; The reason for checking initially-was-dirname
    ;; and not just file-directory-p
    ;; is that file-directory-p is slow over ftp.
    (if (or initially-was-dirname (file-directory-p dirname))
	(setq dirname  (file-name-as-directory dirname)))

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Dired and wildcards
  2007-06-19 16:17       ` Eli Zaretskii
  2007-06-19 16:51         ` Andreas Schwab
@ 2007-06-19 17:53         ` Stefan Monnier
  2007-06-19 19:38           ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-06-19 17:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Andreas Schwab, emacs-devel

> And now to my original question: is there a way to tell Dired to
> interpret "foo[bar]" as a wildcard, even though a file by that literal
> name exists?  You seem to say there is no way, but I'm not sure I
> understand you correctly.

I'd try "foo[arb]" or "foo[barr]" or "[f]oo[bar]" ... you get the idea.


        Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Dired and wildcards
  2007-06-19 17:53         ` Stefan Monnier
@ 2007-06-19 19:38           ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2007-06-19 19:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: schwab, emacs-devel

> Cc: Andreas Schwab <schwab@suse.de>,  emacs-devel@gnu.org
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Tue, 19 Jun 2007 13:53:11 -0400
> 
> > And now to my original question: is there a way to tell Dired to
> > interpret "foo[bar]" as a wildcard, even though a file by that literal
> > name exists?  You seem to say there is no way, but I'm not sure I
> > understand you correctly.
> 
> I'd try "foo[arb]" or "foo[barr]" or "[f]oo[bar]" ... you get the idea.

Or maybe using -d in the ls switches?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Dired and wildcards
  2007-06-19 16:51         ` Andreas Schwab
@ 2007-06-19 19:41           ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2007-06-19 19:41 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

> From: Andreas Schwab <schwab@suse.de>
> Cc: emacs-devel@gnu.org
> Date: Tue, 19 Jun 2007 18:51:51 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > And now to my original question: is there a way to tell Dired to
> > interpret "foo[bar]" as a wildcard, even though a file by that literal
> > name exists?  You seem to say there is no way, but I'm not sure I
> > understand you correctly.
> 
> An existing directory is always preferred, see dired-noselect:
> 
>     ;; If the argument was syntactically  a directory name not a file name,
>     ;; or if it happens to name a file that is a directory,
>     ;; convert it syntactically to a directory name.
>     ;; The reason for checking initially-was-dirname
>     ;; and not just file-directory-p
>     ;; is that file-directory-p is slow over ftp.
>     (if (or initially-was-dirname (file-directory-p dirname))
> 	(setq dirname  (file-name-as-directory dirname)))

Okay, thanks.

In case you are wondering, I asked these questions because the ls-lisp
emulation seems not to behave this way.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-06-19 19:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-19  7:43 Dired and wildcards Eli Zaretskii
2007-06-19  8:40 ` Andreas Schwab
2007-06-19 15:17   ` Eli Zaretskii
2007-06-19 15:30     ` Andreas Schwab
2007-06-19 16:17       ` Eli Zaretskii
2007-06-19 16:51         ` Andreas Schwab
2007-06-19 19:41           ` Eli Zaretskii
2007-06-19 17:53         ` Stefan Monnier
2007-06-19 19:38           ` Eli Zaretskii

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.