Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Minor VCS Info things
- X-seq: zsh-workers 25710
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Minor VCS Info things
- Date: Mon, 22 Sep 2008 15:11:02 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Some minor changes for VCS_Info I'd like to suggest, if they're
uncontroversial.
vcs_comm needs to be local in all top-level functions, otherwise you get
errors trying to set elements in it when it doesn't exist from
e.g. vcs_info_printsys.
I think it's better to sanitize all options with "emulate" rather than
second guess which ones are needed, because there are lots and trying to
guess can easily cause problems (compare the completion code). If there
are options that need to be kept they can be handled specially. The
special problem in completion that stopped us from using "emulate" was
that completion's own behaviour is controlled by options and they're not
easily characterised by their emulation behaviour; I don't think we
should have that problem in an add-on non-interactive function suite,
but we can see.
It's confusing that if you run "vcs_info_printsys" to see what is
available it shows nothing if you haven't yet run "vcs_info" or
"vcs_info_setsys". I think it should run vcs_info_setsys in that case.
The Perforce detector doesn't work very well. $P4CONFIG is not tied to
being in the Perforce workspace: you can have a config file outside a
workspace to set a default client etc., and you don't need one at all if
the client etc. are set via environment variables. The only good way of
detecting whether you're in a workspace is to ask the server.
Unfortunately this can hang (though not permanently) if the server is
not available, so I haven't sent a patch. It could be fixed by adding
an explicit style to use the server and also a global (per server:port
pair) flag that the server didn't respond, so that it only hangs (for a
second or two) the first time.
Index: Functions/VCS_Info/vcs_info_lastmsg
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/VCS_Info/vcs_info_lastmsg,v
retrieving revision 1.1
diff -u -r1.1 vcs_info_lastmsg
--- Functions/VCS_Info/vcs_info_lastmsg 19 Sep 2008 12:58:52 -0000 1.1
+++ Functions/VCS_Info/vcs_info_lastmsg 22 Sep 2008 13:55:25 -0000
@@ -2,7 +2,8 @@
## Written by Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
## Distributed under the same BSD-ish license as zsh itself.
-setopt localoptions NO_shwordsplit
+emulate -L zsh
+
local -i i
local -ix maxexports
Index: Functions/VCS_Info/vcs_info_printsys
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/VCS_Info/vcs_info_printsys,v
retrieving revision 1.1
diff -u -r1.1 vcs_info_printsys
--- Functions/VCS_Info/vcs_info_printsys 19 Sep 2008 12:58:52 -0000 1.1
+++ Functions/VCS_Info/vcs_info_printsys 22 Sep 2008 13:55:25 -0000
@@ -2,13 +2,20 @@
## Written by Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
## Distributed under the same BSD-ish license as zsh itself.
-setopt localoptions noksharrays extendedglob NO_shwordsplit
+emulate -L zsh
+setopt extendedglob
+
local sys
local -a disabled enabled
+local -Ax vcs_comm
zstyle -a ":vcs_info:-init-:${1:-default}:-all-" "enable" enabled
(( ${#enabled} == 0 )) && enabled=( all )
+if (( ${+VCS_INFO_backends} == 0 )); then
+ vcs_info_setsys
+fi
+
if [[ -n ${(M)enabled:#(#i)all} ]] ; then
enabled=( ${VCS_INFO_backends} )
zstyle -a ":vcs_info:-init-:${1:-default}:-all-" "disable" disabled
Index: Functions/VCS_Info/vcs_info_setsys
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/VCS_Info/vcs_info_setsys,v
retrieving revision 1.1
diff -u -r1.1 vcs_info_setsys
--- Functions/VCS_Info/vcs_info_setsys 19 Sep 2008 12:58:52 -0000 1.1
+++ Functions/VCS_Info/vcs_info_setsys 22 Sep 2008 13:55:25 -0000
@@ -2,7 +2,9 @@
## Written by Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
## Distributed under the same BSD-ish license as zsh itself.
-setopt localoptions noksharrays extendedglob typeset_silent NO_shwordsplit
+emulate -L zsh
+setopt extendedglob typeset_silent
+
local sys
typeset -g VCS_INFO_backends
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author