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: Thu, 27 Jun 2013 16:28:08 +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 1372343347 25609 80.91.229.3 (27 Jun 2013 14:29:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Jun 2013 14:29:07 +0000 (UTC) Cc: Emacs help To: Stephen Berman Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 27 16:29:12 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 1UsDCB-00020v-SR for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Jun 2013 16:29:11 +0200 Original-Received: from localhost ([::1]:46615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsDCB-0002Cp-F9 for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Jun 2013 10:29:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsDBt-000273-Og for help-gnu-emacs@gnu.org; Thu, 27 Jun 2013 10:28:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsDBp-0006IM-Pj for help-gnu-emacs@gnu.org; Thu, 27 Jun 2013 10:28:53 -0400 Original-Received: from mail-pd0-x234.google.com ([2607:f8b0:400e:c02::234]:55430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsDBp-0006I0-H1 for help-gnu-emacs@gnu.org; Thu, 27 Jun 2013 10:28:49 -0400 Original-Received: by mail-pd0-f180.google.com with SMTP id 10so421219pdi.11 for ; Thu, 27 Jun 2013 07:28:48 -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=STxa6zl8Mg6P08TDtc5awHl4QuFu/nCtaqFgLOwNGD8=; b=AIWSWqgcC5DYVEhw+R+uZRwwtyWLo4WtVl4H/+AbXqkuyku2kgdm+iZRTEW3o+kRr6 iHfSszFS1mBdms903WFeywz1qxvr4m68RmDrmvDnYZErQ9eBHamPLE4rmnItO8AhJFuJ YLknfemeMZGN6oelp7zPWsqLIAgjJfGlXM1ueGmSjZ3VyTUirk2cjQXgnTarE87ELl7Z GBj8PLA5XlJDRBwDfa+b1GDPuxdqCdGfk6+5/j4k2bZUS0BaVc7niksKySGZw5M1BI5I Rlb0ibYed+apgHHP0ujqblazatCTzmCHRISriBkbM3AWgMlVA6HEcSdSM08rBlkqCt8b zHFw== X-Received: by 10.68.131.168 with SMTP id on8mr6350521pbb.97.1372343328501; Thu, 27 Jun 2013 07:28:48 -0700 (PDT) Original-Received: by 10.68.31.135 with HTTP; Thu, 27 Jun 2013 07:28:08 -0700 (PDT) In-Reply-To: <87wqpfu18t.fsf@rosalinde.fritz.box> X-Google-Sender-Auth: LsujTLVWvnQSSq1vcrJSe8BbP9Q X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::234 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:91776 Archived-At: Thanks, Steve. 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