Subject: Use of "enable" in compsys (Re: Problem after upgrade from 4.3 to 5.2)
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Cc: Henrik Johansson <[email-masked]>
Date: Fri, 15 Apr 2016 21:31:13 -0700
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Apr 16,  2:42am, Oliver Kiddle wrote:
} Subject: Re: Problem after upgrade from 4.3 to 5.2
}
} Henrik Johansson wrote:
} >
} > After upgrade of zsh I got a problem with completion.
} > In this example I write 'ls -l .z<TAB>
} >
} > server.user 1045> ls -l .zenable: printer "-p" non-existent
} 
} There's a name clash for "enable" / "disable" between the shell builtins
} and external commands for enabling/disabling printers.

Seems like there ought to be a way to invoke a disabled builtin, at least
in the case of enable, but we can easily avoid Henrik's error.  Additional
changes below are to use explicit semicolons on all lines in _comp_setup,
I'm not sure why those were used on some of them but not others, but it
seems prudent to have them.

diff --git a/Completion/compinit b/Completion/compinit
index 4b9a778..6612bac 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -167,11 +167,11 @@ _comp_options=(
 typeset -gH _comp_setup='local -A _comp_caller_options;
              _comp_caller_options=(${(kv)options[@]});
              setopt localoptions localtraps localpatterns ${_comp_options[@]};
-             local IFS=$'\'\ \\t\\r\\n\\0\''
-             enable -p \| \~ \( \? \* \[ \< \^ \#
+             local IFS=$'\'\ \\t\\r\\n\\0\'';
+             builtin enable -p \| \~ \( \? \* \[ \< \^ \# 2>/dev/null;
              exec </dev/null;
-             trap - ZERR
-             local -a reply
+             trap - ZERR;
+             local -a reply;
              local REPLY'
 
 # These can hold names of functions that are to be called before/after all

-- 
Barton E. Schaefer