[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dired-guess-shell-alist-user: How to match folders instead of file t
From: |
Stephen Berman |
Subject: |
Re: dired-guess-shell-alist-user: How to match folders instead of file types? |
Date: |
Thu, 27 Jun 2013 15:33:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
On Thu, 27 Jun 2013 14:25:20 +0200 Marius Hofert <marius.hofert@math.ethz.ch>
wrote:
> On Thu, Jun 27, 2013 at 1:48 PM, Stephen Berman <stephen.berman@gmx.net>
> wrote:
>> On Thu, 27 Jun 2013 13:22:00 +0200 Marius Hofert
>> <marius.hofert@math.ethz.ch> wrote:
>>
>>> ... I was too fast. It does indeed work now for the point being on
>>> directories. However, for the other assignments (like using unzip on
>>> .zip files) I don't get the corresponding suggestion anymore...
>>>
>>> I put your code in the beginning of 'dired-guess-shell-alist-user' as you
>>> said.
>>
>> Sorry, I made a silly mistake: the regexp `.*' matches any file, so the
>> entry needs to be the *last* one in dired-guess-shell-alist-user.
>
> Thanks, Steve.
>
>> But then you have to be sure that none of the preceding entries match a
>> directory. This will probably be true of any file ending in `.zip',
>> `.tgz', etc. If you do have any directories whose names have endings
>> that could also be used for non-directory files,
>
> Including or excluding the dot '.'? There are rarely directories named
> 'My.zip", but I could imagine a directory Myzip to exist.
`Myzip' would be matched by ".*" (the dot here is a special character in
the regexp, matching any character). But if you have a directory
`My.zip' it would have already been matched by "\.zip\'", so here you'll
have to add the Lisp expression to prevent the wrong shell command from
applying to it. However, what I wrote previously was insufficient: once
the match is satisfied, no further patterns are tested. So if you want
the shell command suggestion with `!' in Dired to be unzip on a
non-directory file "Myfile.zip" and to be zip on a directory
"Mydir.zip", the entry in dired-guess-shell-alist-user should be this
(modulo whatever your actual shell commands are):
("\\.zip\\'" (if (file-directory-p (dired-get-filename))
"(zip ? &>/dev/null &)"
"(unzip ? &>/dev/null &)"))
(This time I actually tested it, so I hope it now really works for you!)
Steve Berman
- dired-guess-shell-alist-user: How to match folders instead of file types?, Marius Hofert, 2013/06/25
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Peter Dyballa, 2013/06/25
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Marius Hofert, 2013/06/25
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Peter Dyballa, 2013/06/25
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Stephen Berman, 2013/06/25
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Marius Hofert, 2013/06/25
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Marius Hofert, 2013/06/27
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Stephen Berman, 2013/06/27
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Marius Hofert, 2013/06/27
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?,
Stephen Berman <=
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Marius Hofert, 2013/06/27
- Re: dired-guess-shell-alist-user: How to match folders instead of file types?, Marius Hofert, 2013/06/30
RE: dired-guess-shell-alist-user: How to match folders instead of file types?, Doug Lewan, 2013/06/25