zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: zsh_directory_name_generic fix
@ 2015-12-14 10:32 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2015-12-14 10:32 UTC (permalink / raw)
  To: Zsh Hackers' List

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-14 10:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 10:32 PATCH: zsh_directory_name_generic fix Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).