    Thorsten Haude's inclusion of new NEdit Macro variables $NEDIT_HOME
    and $VERSION.

    Part of his "patch collection", see

    http://sourceforge.net/tracker/index.php?func=detail&aid=1058246&group_id=11005&atid=311005
	    [ 1058246 ] Patch Collection

    2006-11-22

    Updaed to track CVS Head,

diff -aur nedit_official nedit_mod
diff -aur nedit_official/source/macro.c nedit_mod/source/macro.c
--- nedit_official/source/macro.c	2006-11-22 16:22:01.000000000 +0100
+++ nedit_mod/source/macro.c	2006-11-22 18:09:46.546875000 +0100
@@ -361,6 +361,8 @@
 	int nArgs, DataValue *result, char **errMsg);
 static int versionMV(WindowInfo* window, DataValue* argList, int nArgs,
         DataValue* result, char** errMsg);
+static int neditHomeMV(WindowInfo* window, DataValue* argList, int nArgs,
+        DataValue* result, char** errMsg);
 static int rangesetCreateMS(WindowInfo *window, DataValue *argList, int nArgs,
       DataValue *result, char **errMsg);
 static int rangesetDestroyMS(WindowInfo *window, DataValue *argList, int nArgs,
@@ -460,7 +462,7 @@
         displayWidthMV, activePaneMV, nPanesMV, emptyArrayMV,
         serverNameMV, calltipIDMV,
 /* DISABLED for 5.4        backlightStringMV, */
-	rangesetListMV, versionMV
+	rangesetListMV, versionMV, neditHomeMV
     };
 #define N_SPECIAL_VARS (sizeof SpecialVars/sizeof *SpecialVars)
 static const char *SpecialVarNames[N_SPECIAL_VARS] = {"$cursor", "$line", "$column",
@@ -478,7 +480,7 @@
         "$display_width", "$active_pane", "$n_panes", "$empty_array",
         "$server_name", "$calltip_ID",
 /* DISABLED for 5.4       "$backlight_string", */
-        "$rangeset_list", "$VERSION"
+        "$rangeset_list", "$VERSION", "$NEDIT_HOME"
     };
 
 /* Global symbols for returning values from built-in functions */
@@ -4610,6 +4612,27 @@
 }
 
 /*
+**  Returns the name of the directory where NEdit's run control files reside.
+**  This is either the value of the environmental variable $NEDIT_HOME, the
+**  default of ~/.nedit or $HOME. (See the online documentation for details
+**  about the algorithm.)
+*/
+static int neditHomeMV(WindowInfo* window, DataValue* argList, int nArgs,
+        DataValue* result, char** errMsg)
+{
+    const char* neditRCName = GetRCFileName(NEDIT_RC);
+    char nedit_home[MAXPATHLEN];
+
+    if (0 != ParseFilename(neditRCName, NULL, nedit_home)) {
+        M_FAILURE("Unable to parse nedit rc file name in %s");
+    }
+
+    result->tag = STRING_TAG;
+    AllocNStringCpy(&result->val.str, nedit_home);
+    return True;
+}
+
+/*
 ** Built-in macro subroutine to create a new rangeset or rangesets.  
 ** If called with one argument: $1 is the number of rangesets required and 
 ** return value is an array indexed 0 to n, with the rangeset labels as values;
