From: Marius Hofert <marius.hofert@math.ethz.ch>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: Emacs help <help-gnu-emacs@gnu.org>
Subject: Re: dired-guess-shell-alist-user: How to match folders instead of file types?
Date: Sun, 30 Jun 2013 21:38:03 +0200 [thread overview]
Message-ID: <CAM3-KjbDC6_7+Sd4JSnvfUsrdhG-btyy6am_yDL5w7PLZdu2GA@mail.gmail.com> (raw)
In-Reply-To: <87wqpfu18t.fsf@rosalinde.fritz.box>
Hi Steve,
If I have marked ('m') several files in dired-mode and use '!', I get
"No file on this line" and no choice to put in a command. I think it
has to do with the "(when (file-directory-p (dired-get-filename)))".
If you just use (".*" "(tar czf all.tar.gz ? &>/dev/null &)") as last
entry, for example, this problem does not appear.
Cheers,
Marius
On Thu, Jun 27, 2013 at 3:33 PM, Stephen Berman <stephen.berman@gmx.net> wrote:
> 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
next prev parent reply other threads:[~2013-06-30 19:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 11:24 dired-guess-shell-alist-user: How to match folders instead of file types? Marius Hofert
2013-06-25 11:42 ` Peter Dyballa
2013-06-25 12:02 ` Marius Hofert
2013-06-25 14:00 ` Peter Dyballa
2013-06-25 19:28 ` Stephen Berman
2013-06-25 20:34 ` Marius Hofert
2013-06-27 11:22 ` Marius Hofert
2013-06-27 11:48 ` Stephen Berman
2013-06-27 12:25 ` Marius Hofert
2013-06-27 13:33 ` Stephen Berman
2013-06-27 14:28 ` Marius Hofert
2013-06-30 19:38 ` Marius Hofert [this message]
2013-06-25 14:35 ` Doug Lewan
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=CAM3-KjbDC6_7+Sd4JSnvfUsrdhG-btyy6am_yDL5w7PLZdu2GA@mail.gmail.com \
--to=marius.hofert@math.ethz.ch \
--cc=help-gnu-emacs@gnu.org \
--cc=stephen.berman@gmx.net \
/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.