From 43386376d8f861fe46ad59c616569c26fed631a9 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 1 Oct 2015 16:18:56 +0000 Subject: [PATCH 1/3] Set the version number. Store it in a separate file so OS packages and 'make install' (issue #177) can reuse it. --- .version | 1 + zsh-syntax-highlighting.zsh | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 .version diff --git a/.version b/.version new file mode 100644 index 0000000..0ba2319 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +0.3.0-dev \ No newline at end of file diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index ce9db28..3c3163d 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -29,6 +29,8 @@ # ------------------------------------------------------------------------------------------------- +ZSH_HIGHLIGHT_VERSION=$(<"$0:h"/.version) + # ------------------------------------------------------------------------------------------------- # Core highlighting update system # ------------------------------------------------------------------------------------------------- From 9c56c624e98134e565c0b16da77a5d7bd71236f6 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 1 Oct 2015 16:26:43 +0000 Subject: [PATCH 2/3] versionstamp: Handle NO_FUNCTION_ARGZERO. Sourcing zsh-syntax-highlighting.zsh without FUNCTION_ARGZERO doesn't work (for reasons unrelated to this branch), but now errors out gracefully. The failure mode before this branch was: zsh-syntax-highlighting: highlighters directory '/usr/local/bin/highlighters' not found. where /usr/local/bin is dirname() of the zsh binary. --- zsh-syntax-highlighting.zsh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 3c3163d..a65b29f 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -29,7 +29,16 @@ # ------------------------------------------------------------------------------------------------- -ZSH_HIGHLIGHT_VERSION=$(<"$0:h"/.version) +if [[ -o function_argzero ]]; then + # $0 is reliable + ZSH_HIGHLIGHT_VERSION=$(<"$0:h"/.version) +else + # $0 is unreliable, so the call to _zsh_highlight_load_highlighters will fail. + # TODO: If 'zmodload zsh/parameter' is available, ${funcsourcetrace[1]%:*} might serve as a substitute? + # TODO: also check POSIX_ARGZERO, but not it's not available in older zsh + echo "zsh-syntax-highlighting: error: not compatible with FUNCTION_ARGZERO" >&2 + return 1 +fi # ------------------------------------------------------------------------------------------------- # Core highlighting update system From c538d6b35750df11c3750658bf0b23d4efdf0da8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 2 Oct 2015 18:12:07 +0000 Subject: [PATCH 3/3] versionstamp: Set up '.revision-hash' file. --- .gitattributes | 1 + .revision-hash | 1 + 2 files changed, 2 insertions(+) create mode 100644 .gitattributes create mode 100644 .revision-hash diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..715e624 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.revision-hash export-subst diff --git a/.revision-hash b/.revision-hash new file mode 100644 index 0000000..6828f88 --- /dev/null +++ b/.revision-hash @@ -0,0 +1 @@ +$Format:%H$