From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19617 invoked by alias); 14 Dec 2015 10:32:30 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37400 Received: (qmail 9711 invoked from network); 14 Dec 2015 10:32:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_HDRS_LCASE, T_MANY_HDRS_LCASE autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f5-f79b16d000005389-1b-566e9ab87480 Date: Mon, 14 Dec 2015 10:32:21 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: PATCH: zsh_directory_name_generic fix Message-id: <20151214103221.4ee76b69@pwslap01u.europe.root.pri> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOLMWRmVeSWpSXmKPExsVy+t/xK7o7ZuWFGZzZImRxsPkhkwOjx6qD H5gCGKO4bFJSczLLUov07RK4MjasbWYveMZTcW1uC3sD41yuLkYODgkBE4k9PXxdjJxAppjE hXvr2boYuTiEBJYySqy5vIsJwpnBJDFz5SxWCOcco8TMd3OgMmcZJX5Nu8sG0s8ioCrx6WAH E4jNJmAoMXXTbEaQFSIC2hLtH8VAwsICehJ3Ti1iBrF5Bewlntz5wApi8wvoS1z9+4kJ4gx7 iZlXzjBC1AhK/Jh8jwXEZhbQkti8rYkVwpaX2LzmLdgcIQF1iRt3d7NPYBSchaRlFpKWWUha FjAyr2IUTS1NLihOSs810itOzC0uzUvXS87P3cQICc6vOxiXHrM6xCjAwajEw5uxLDdMiDWx rLgy9xCjBAezkghvglVemBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHembvehwgJpCeWpGanphak FsFkmTg4pRoYW/xs5YJu3DZq4pXd4x3a35+umF3Q1sokmZ+Q1bpCeu/pfxVVYgvadhvd+dH2 5uGrJWe/nxe3UdC5s/SL1W6Raa3hW59ePfdqntXfl8srLt3PcD3qWT2lci7zbjeTXZq50ib8 cf/PTfFPbFOwlb93TdzPI8ZDw67w18PmrH6XKee3szbtUBZUYinOSDTUYi4qTgQAchrNLkoC AAA= Documented behaviour: if you refer to ~[x:y:z] and the function over zsh_directory_name_generic doesn't handle the "x" component you don't get an error, it simply returns 1 and lets another function handle it, whereas if it does handle the "x" but doesn't handle one of the later components it considers itself committed and reports an error. Owing to a typo, the current actual behaviour is you always get an error message. Discovered this when I put a second mapper behind my git mapper. The hook handler doesn't distinguish the two cases, in fact, so the message is the only difference. This behaviour could be made configurable but currently it looks like an unnecessary complexity. Another cosmetic typo fixed, too. pws diff --git a/Functions/Chpwd/zsh_directory_name_generic b/Functions/Chpwd/zsh_directory_name_generic index 9430c95..aa4bf9b 100644 --- a/Functions/Chpwd/zsh_directory_name_generic +++ b/Functions/Chpwd/zsh_directory_name_generic @@ -16,7 +16,7 @@ zmodload -i zsh/parameter zstyle -s ":zdn:${funcstack[2]}:" mapping _zdn_topvar || _zdn_topvar=zdn_top if (( ! ${(P)#_zdn_topvar} )); then - print -r -- "$0: $_zdn_topver is not set" >&2 + print -r -- "$0: $_zdn_topvar is not set" >&2 return 1 fi @@ -43,7 +43,7 @@ if [[ $1 = n ]]; then if [[ -z $_zdn_cpt ]]; then # If top level component, just try another expansion - if [[ $_zdn_var != $_zdn_top ]]; then + if [[ $_zdn_var != $_zdn_topvar ]]; then # Committed to this expansion, so report failure. print -r -- "$0: no expansion for directory name \`$_zdn_name'" >&2 fi