zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Minor VCS Info things
Date: Mon, 22 Sep 2008 15:11:02 +0100	[thread overview]
Message-ID: <15055.1222092662@csr.com> (raw)

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@bewatermyfriend.org>
 ## 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@bewatermyfriend.org>
 ## 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@bewatermyfriend.org>
 ## 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@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


             reply	other threads:[~2008-09-22 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22 14:11 Peter Stephenson [this message]
2008-09-22 16:48 ` Frank Terbeck
2008-09-22 23:43 ` Phil Pennock
2008-09-23 16:02 ` Peter Stephenson
2008-09-23 19:15   ` Phil Pennock
2008-09-24  8:46     ` Peter Stephenson
2008-09-24  9:08       ` Phil Pennock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15055.1222092662@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).