From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29323 invoked from network); 17 Mar 2009 18:47:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Mar 2009 18:47:33 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 96508 invoked from network); 17 Mar 2009 18:47:26 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Mar 2009 18:47:26 -0000 Received: (qmail 21249 invoked by alias); 17 Mar 2009 18:47:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26750 Received: (qmail 21233 invoked from network); 17 Mar 2009 18:47:22 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 17 Mar 2009 18:47:22 -0000 Received: from vms173005pub.verizon.net (vms173005pub.verizon.net [206.46.173.5]) by bifrost.dotsrc.org (Postfix) with ESMTP id 32697801E294 for ; Tue, 17 Mar 2009 19:47:18 +0100 (CET) Received: from torch.brasslantern.com ([96.249.201.13]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KGN0086WYSV1Z00@vms173005.mailsrvcs.net> for zsh-workers@sunsite.dk; Tue, 17 Mar 2009 13:46:13 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id n2HIk6Gg017774 for ; Tue, 17 Mar 2009 11:46:07 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id n2HIk6Yl017773 for zsh-workers@sunsite.dk; Tue, 17 Mar 2009 11:46:06 -0700 From: Bart Schaefer Message-id: <090317114606.ZM17772@torch.brasslantern.com> Date: Tue, 17 Mar 2009 11:46:05 -0700 In-reply-to: <20090317095717.02bedf7e@news01> Comments: In reply to Peter Stephenson "Re: Bug#519535: history expansion: modifier completion missing" (Mar 17, 9:57am) References: <20090313105555.GA19025@piper.oerlikon.madduck.net> <20090315062253.GB14010@scru.org> <20090316181852.27e9420d@news01> <090316194434.ZM16487@torch.brasslantern.com> <20090317095717.02bedf7e@news01> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@sunsite.dk Subject: Modifiers, command position, and so forth (Re: Bug#519535: history expansion: modifier completion missing) MIME-version: 1.0 Content-type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.92.1/9124/Tue Mar 17 18:48:04 2009 on bifrost X-Virus-Status: Clean On Mar 17, 9:57am, Peter Stephenson wrote: } } > torch% echo foo } > torch% !!:a } > /usr/local/src/zsh/zsh-build/echo foo } > zsh: no such file or directory: /usr/local/src/zsh/zsh-build/echo } > } > That's almost certainly not the intended behavior ... is it? } } It depends what you mean by "intended": Michael did say the operation } didn't take account of whether the file existed (but I didn't document } this), and there was never any special behaviour for command words. I guess I'm a little skeptical of the utility of this new option in general. All the other modifiers do something "inside" the history string, which would otherwise be difficult to do -- change case, truncate, substitute, etc. This one is just prepending something in a way that can already easily be done with $PWD/!$ (for example). So if it's not going to be intelligent about what it does, what's the point? On the other hand I agree with your conclusion later in this thread that having :a behave like `whence` depending on whether it is used on the command word, is also confusing. Consequently I can't decide what intelligence is appropriate. It'd be a lot more useful if :w worked on history; !*:w:a to make all the arguments into paths would be handy. It'd be REALLY handy if :a figured out what the current directory was at the time the historical command was originally executed and pasted THAT directory onto the front of the command word, rather than always using the value of $PWD. Sort of an uber-$OLDPWD for all history. Here's another case where some intelligence could be applied: schaefer<549> cd Src/Zle schaefer<550> echo ../b* ../builtin.c schaefer<551> echo !$:a echo /usr/local/src/zsh/zsh-4.0/Src//b* /usr/local/src/zsh/zsh-4.0/Src//builtin.c Double slash? Incidentally, it's not just (:c) that doesn't work if there's no file matching the name. Any other modifier-as-qualifier will fail, too. This apparently leads to yet other oddities for "command position". schaefer<503> /bin/echo xxx xxx schaefer<504> /bin/echo(:h) xx zsh: permission denied: /bin schaefer<505> /bin/echo(:t) xx xx schaefer<506> /bin/echo(:a) xx xx All as expected. But now it gets weird: schaefer<508> echo(:t) xx zsh: command not found: xx schaefer<509> echo echo(:t) xx zsh: no match schaefer<510> echo(:a) xx zsh: command not found: xx The command disappears entirely when the qualifier fails. This turns out to be some strange side-effect of cshnullglob: schaefer<514> unsetopt cshnullglob schaefer<515> echo(:a) xx zsh: no matches found: echo(:a) (Hrm, different error message, too.) --