From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marius Hofert Newsgroups: gmane.emacs.help Subject: Re: dired-guess-shell-alist-user: How to match folders instead of file types? Date: Sun, 30 Jun 2013 21:38:03 +0200 Message-ID: References: <792EB2D2-E2CF-446E-ADF4-5B5BD92C8146@Web.DE> <87r4fq56t1.fsf@rosalinde.fritz.box> <874ncjvknu.fsf@rosalinde.fritz.box> <87wqpfu18t.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1372621139 5052 80.91.229.3 (30 Jun 2013 19:38:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Jun 2013 19:38:59 +0000 (UTC) Cc: Emacs help To: Stephen Berman Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 30 21:39:00 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UtNSe-0004iT-JS for geh-help-gnu-emacs@m.gmane.org; Sun, 30 Jun 2013 21:39:00 +0200 Original-Received: from localhost ([::1]:57396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtNSe-0001SR-1l for geh-help-gnu-emacs@m.gmane.org; Sun, 30 Jun 2013 15:39:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtNSS-0001SJ-09 for help-gnu-emacs@gnu.org; Sun, 30 Jun 2013 15:38:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtNSP-0007cG-7J for help-gnu-emacs@gnu.org; Sun, 30 Jun 2013 15:38:47 -0400 Original-Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]:38774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtNSP-0007cB-0x for help-gnu-emacs@gnu.org; Sun, 30 Jun 2013 15:38:45 -0400 Original-Received: by mail-pd0-f178.google.com with SMTP id w11so2082271pde.37 for ; Sun, 30 Jun 2013 12:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=a/aHfctht1qcUPbU5qe8kZp+ePHkcFvohlJbRl2GgTw=; b=WpdYAfzM9wKxcQUKSKbN2FcTKOPXg6IJTNZiYFmSXw2QrYy1ehvM1ccilbzCDIY3h9 PIlOvCSdJUVGJ3255QZS1+HwCJ8+eMvwcUWzZ1y+I4WjoJFlYhwKgPiBNO8EBH/aX3SB KpRfKu4R9rK4D79Ur31LNvULqnC3Ac2N3nt//v1Jz8F2h9d2T15uxabXggv3EoLicPyH gvxKwM4sHATIRlKKUulJ8xttgp6eeUg+/kQ9SmhajBA3U3/fwJ4q2oSKwyCRa6zSFAMx 9fC5US+FNp8pfiRLVo229NkTJiTCTRIJoIIhunJCgtgkXXuSbirj/3WBHEEcaBDH3tsh wggQ== X-Received: by 10.68.131.168 with SMTP id on8mr20565550pbb.97.1372621123648; Sun, 30 Jun 2013 12:38:43 -0700 (PDT) Original-Received: by 10.68.31.135 with HTTP; Sun, 30 Jun 2013 12:38:03 -0700 (PDT) In-Reply-To: <87wqpfu18t.fsf@rosalinde.fritz.box> X-Google-Sender-Auth: qte_zRrCu9diiBVps24j-gHfR2o X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91877 Archived-At: 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 wrote: > On Thu, 27 Jun 2013 14:25:20 +0200 Marius Hofert wrote: > >> On Thu, Jun 27, 2013 at 1:48 PM, Stephen Berman wrote: >>> On Thu, 27 Jun 2013 13:22:00 +0200 Marius Hofert >>> 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