From: Marc Weber <marco-oweber@gmx.de>
Subject: [PATCH] marc/version-comparison

allow has('vim-73-patch148')

---
 runtime/doc/eval.txt  |  9 +++++----
 src/eval.c            |  4 ++--
 src/proto/version.pro |  1 +
 src/version.c         | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index f7cc93b..97c9d4b 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -6309,11 +6309,12 @@ There are three types of features:
     Example: >
 	:if has("gui_running")
 <							*has-patch*
-3.  Included patches.  First check |v:version| for the version of Vim.
-    Then the "patch123" feature means that patch 123 has been included for
-    this version.  Example (checking version 6.2.148 or later): >
+3.  Included patches.
+    Check for has('vim-602-patch148') which will return 1 if >
 	:if v:version > 602 || v:version == 602 && has("patch148")
-<   Note that it's possible for patch 147 to be omitted even though 148 is
+<   which is an older way to do the same.
+
+    Note that it's possible for patch 147 to be omitted even though 148 is
     included.
 
 all_builtin_terms	Compiled with all builtin terminals enabled.
diff --git a/src/eval.c b/src/eval.c
index 83233c9..8530d77 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -12536,8 +12536,8 @@ f_has(argvars, rettv)
 
     if (n == FALSE)
     {
-	if (STRNICMP(name, "patch", 5) == 0)
-	    n = has_patch(atoi((char *)name + 5));
+	if (STRNICMP(name, "patch", 5) == 0 || STRNICMP(name, "vim-", 4) == 0)
+	    n = has_vim_and_patch(name);
 	else if (STRICMP(name, "vim_starting") == 0)
 	    n = (starting != 0);
 #ifdef FEAT_MBYTE
diff --git a/src/proto/version.pro b/src/proto/version.pro
index 3f371f9..1979a29 100644
--- a/src/proto/version.pro
+++ b/src/proto/version.pro
@@ -2,6 +2,7 @@
 void make_version __ARGS((void));
 int highest_patch __ARGS((void));
 int has_patch __ARGS((int n));
+int has_vim_and_patch __ARGS((u_char *name));
 void ex_version __ARGS((exarg_T *eap));
 void list_version __ARGS((void));
 void intro_message __ARGS((int colon));
diff --git a/src/version.c b/src/version.c
index e8febd5..56b6bf5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -3015,6 +3015,42 @@ highest_patch()
 
 #if defined(FEAT_EVAL) || defined(PROTO)
 /*
+ * name something like: vim-703-patch-XXX or patch-xxx
+ */
+    int
+has_vim_and_patch(name)
+    char_u *	name;
+{
+
+    if (STRNICMP(name, "vim-", 4) == 0) {
+        // check vim version
+        name+=4;
+
+        char_u vim_version[8];
+        int i;
+        for (i = 0; i < 8; ++i)
+        {
+            if (*name >= '0' && *name <= '9')
+            {
+                vim_version[i] = *(name++);
+            } else {
+                vim_version[i] = '\0';
+                break;
+            }
+        }
+
+        if (VIM_VERSION_100 < atoi(&vim_version[0]))
+            return 0;
+
+        if (*(name++) != '-') return 0;
+    }
+
+    if (STRNICMP(name, "patch", 5) != 0) return 0;
+    return has_patch(atoi(name + 5));
+}
+
+
+/*
  * Return TRUE if patch "n" has been included.
  */
     int
-- 
tg: (cbe6d27..) marc/version-comparison (depends on: marc/parallel-compilation)
