From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27789 invoked by alias); 22 Jan 2013 10:58:52 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17601 Received: (qmail 11328 invoked from network); 22 Jan 2013 10:58:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.223.179 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=PAbB+dnvG55hsgKZqnh1ELaN7b35B3wzXVi9mP4zVrM=; b=RR+yC2ne3mnjzSTedlyv5GGeyoEXmepWjSW2jJ+8kpA2HmrdDIUCZTi32qZXJ52paW qEm/6cM+nI/to8YZLVVrqsuxaNTa0FONnvLKBlpHlObIIUBDVjDfqk+jwwf1Rbj6AQPi 4rckZ+ATwtoKIWgs2XqDpbi/qutk3yaOPRh0Oyr+PU2LI25pB3NJIAylJjw6bRrNNS/Q 74+xpAqXqCbaP7NKKIbGmNYphoShUqz8nZuMaTMzGLkGf1BwisB7nNALLoMFD3bIjBC9 oXQVBPuEeoHCbGDQZfFCLVRJFK2cJnfflxKOThSe54/IHVOWHmGcvl/4qx7PvHOqfSeW s9sg== MIME-Version: 1.0 X-Received: by 10.50.193.234 with SMTP id hr10mr11630512igc.21.1358852324668; Tue, 22 Jan 2013 02:58:44 -0800 (PST) In-Reply-To: <20130122101440.GA8372@picard.franken.de> References: <20130122101440.GA8372@picard.franken.de> Date: Tue, 22 Jan 2013 11:58:44 +0100 Message-ID: Subject: Re: Resolving absolute path of named directory From: =?ISO-8859-1?Q?Jesper_Nyg=E5rds?= To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=14dae934069f1d367b04d3de76fa --14dae934069f1d367b04d3de76fa Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, Jan 22, 2013 at 11:14 AM, Thomas K=F6hler wrote: > I expect what you want is not > % pr=3D~/projects > % mydir=3D"~pr" > but > % pr=3D~/projects > % mydir=3D"$pr" > instead. Or you might want > % mydir=3D~/projects > % print ${mydir:a} > > Thank you for your help, Thomas, but I believe my example obscured what I am trying to do, so I will try to clarify with a better example. Consider this zle widget that I believe I have picked up from this list: current-argument-absolute-path() { modify-current-argument '$ARG:a' } zle -N current-argument-absolute-path bindkey '\e+' current-argument-absolute-path As its name implies, it takes the current word on the command line, and replaces it with its corresponding absolute path. However, it does not work for named directories. If I write ls ~<\e+> when standing in, say, /usr/lib, it expands the "~" to "/usr/lib/~", not "/home/jesper". And the same for named directories that I have defined myself. So my question is, can I rewrite this function so that if what's on the command line is a named directory, it is expanded into its correct absolute path? And I still want it to work for arguments that are not named directories, of course. --14dae934069f1d367b04d3de76fa--