zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: vcs_info, implement disable-patterns style
@ 2008-12-31 14:42 Frank Terbeck
  2008-12-31 14:47 ` PATCH: vcs_info, implement disable-patterns style (2nd try) Frank Terbeck
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Terbeck @ 2008-12-31 14:42 UTC (permalink / raw)
  To: zsh workers

---

Someone on IRC asked for this. So, here it is.

Regards, Frank


 Doc/Zsh/contrib.yo          |   10 ++++++++++
 Functions/VCS_Info/vcs_info |   13 ++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index c393d28..826fb20 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -506,6 +506,16 @@ A list of VCSs, you don't want var(vcs_info) to test for
 repositories (checked in the var(-init-) context, too). Only used if
 tt(enable) contains tt(ALL).
 )
+kindex(disable-patterns)
+item(tt(disable-patterns))(
+A list of patterns that are checked against tt($PWD). If the pattern
+matches, var(vcs_info) will is disabled. This style is checked in the
+var(:vcs_info:-init-:*:-all-) context.
+
+Say, tt(~/.zsh) is a directory under version control, in which you do
+not want var(vcs_info) to be active, do:
+example(zstyle ':vcs_info:*' disable-patterns "$HOME/.zsh+LPAR()|/*+RPAR()")
+)
 kindex(command)
 item(tt(command))(
 This style causes var(vcs_info) to use the supplied string as the command
diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info
index 7ecd122..d491e69 100644
--- a/Functions/VCS_Info/vcs_info
+++ b/Functions/VCS_Info/vcs_info
@@ -41,8 +41,9 @@ vcs_info () {
     emulate -L zsh
     setopt extendedglob
 
+    local pat
     local -i found
-    local -a enabled disabled
+    local -a enabled disabled dps
     local -x usercontext vcs rrn
     local -ix maxexports
     local -ax msgs
@@ -64,6 +65,16 @@ vcs_info () {
         zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "disable" disabled
     fi
 
+    zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "disable-patterns" dps
+    (( ${#dps} == 0 )) && dps=()
+
+    for pat in ${dps} ; do
+        if [[ ${PWD} == ${~pat} ]] ; then
+            [[ -n ${vcs_info_msg_0_} ]] && VCS_INFO_set --clear
+            return 0
+        fi
+    done
+
     VCS_INFO_maxexports
 
     (( found = 0 ))
-- 
1.6.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* PATCH: vcs_info, implement disable-patterns style (2nd try)
  2008-12-31 14:42 PATCH: vcs_info, implement disable-patterns style Frank Terbeck
@ 2008-12-31 14:47 ` Frank Terbeck
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Terbeck @ 2008-12-31 14:47 UTC (permalink / raw)
  To: zsh workers

---

Frank Terbeck <ft@bewatermyfriend.org>:
> +    zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "disable-patterns" dps
> +    (( ${#dps} == 0 )) && dps=()

Well, that 2nd line is obviously not needed...
Here is an updated patch.

Regards, Frank


 Doc/Zsh/contrib.yo          |   10 ++++++++++
 Functions/VCS_Info/vcs_info |   12 +++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index c393d28..826fb20 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -506,6 +506,16 @@ A list of VCSs, you don't want var(vcs_info) to test for
 repositories (checked in the var(-init-) context, too). Only used if
 tt(enable) contains tt(ALL).
 )
+kindex(disable-patterns)
+item(tt(disable-patterns))(
+A list of patterns that are checked against tt($PWD). If the pattern
+matches, var(vcs_info) will is disabled. This style is checked in the
+var(:vcs_info:-init-:*:-all-) context.
+
+Say, tt(~/.zsh) is a directory under version control, in which you do
+not want var(vcs_info) to be active, do:
+example(zstyle ':vcs_info:*' disable-patterns "$HOME/.zsh+LPAR()|/*+RPAR()")
+)
 kindex(command)
 item(tt(command))(
 This style causes var(vcs_info) to use the supplied string as the command
diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info
index 7ecd122..a821e4d 100644
--- a/Functions/VCS_Info/vcs_info
+++ b/Functions/VCS_Info/vcs_info
@@ -41,8 +41,9 @@ vcs_info () {
     emulate -L zsh
     setopt extendedglob
 
+    local pat
     local -i found
-    local -a enabled disabled
+    local -a enabled disabled dps
     local -x usercontext vcs rrn
     local -ix maxexports
     local -ax msgs
@@ -64,6 +65,15 @@ vcs_info () {
         zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "disable" disabled
     fi
 
+    zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "disable-patterns" dps
+
+    for pat in ${dps} ; do
+        if [[ ${PWD} == ${~pat} ]] ; then
+            [[ -n ${vcs_info_msg_0_} ]] && VCS_INFO_set --clear
+            return 0
+        fi
+    done
+
     VCS_INFO_maxexports
 
     (( found = 0 ))
-- 
1.6.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-31 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-31 14:42 PATCH: vcs_info, implement disable-patterns style Frank Terbeck
2008-12-31 14:47 ` PATCH: vcs_info, implement disable-patterns style (2nd try) Frank Terbeck

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).