  Extend the raise_window action routine.

  Available as a patch:

  http://sourceforge.net/tracker/index.php?func=detail&aid=970492&group_id=11005&atid=311005
	    [ 970492 ] Extend the raise_window action routine
	    RaiseWindowForMacro.diff	2004-06-10 08:37

  Adds the following functionality to the raise_window() action routine:

  - if the first argument is "focus", raises the window which currently has the
    macro focus
  - if the first argument looks like the name of an open file, raises the
    relevant window
  - if no argument is given, uses the macro focus window explicitly

diff -ur nedit_official nedit_mod
diff -ur nedit_official/doc/help.etx nedit_mod/doc/help.etx
--- nedit_official/doc/help.etx	2006-10-03 02:10:59.233220000 +0200
+++ nedit_mod/doc/help.etx	2006-10-03 02:16:07.085891200 +0200
@@ -3540,12 +3540,17 @@
   Moves the cursor up one line.  If "absolute" is given, always moves to the
   previous line in the text buffer, regardless of wrapping.
 
-**raise_window([relative-window] | [positive-index] | [negative-index] [, "focus" | "nofocus"])**
-  Raise the current focused window to the front if no argument is supplied.
-  Arguments can be specified in the form of a relative-window
-  ("first", "last", "next", "previous"), a positive-index
-  (numbers greater than 0, 1 is the same as "last") or a
-  negative-index (numbers less than 0, -1 is the same as "first").
+**raise_window([which-window] [, "focus" | "nofocus"])**
+  If no argument is supplied, make the current focused document tab visible and
+  bring its window to the front. Otherwise, a single argument can be specified
+  to specify the document to raise. The argument can be in the form of a
+  document-specifying instruction ("first", "last", "next", "previous" which
+  provide access in relation to order of opening, or "focus" for the current
+  macro document); the full name of an open document (its file path and name);
+  or a numeric index of the document in order of opening. If the index is
+  positive, it is treated as a count of "next" steps from "last" (with 1 for
+  "last" itself); if negative, these are "previous" steps (with -1 for "first").
+  0 is invalid.
 
   Moreover, it can be specified whether or not the raised window should
   request the X input focus. By default, it depends on the setting of the
diff -ur nedit_official/source/menu.c nedit_mod/source/menu.c
--- nedit_official/source/menu.c	2004-12-23 17:25:45.000000000 -0500
+++ nedit_mod/source/menu.c	2005-01-03 14:30:10.973747000 -0500
@@ -3775,10 +3775,17 @@
     WindowInfo *nextWindow;
     WindowInfo *tmpWindow;
     int windowIndex;
+    char dummy[2];
     Boolean focus = GetPrefFocusOnRaise();
 
     if (*nArgs > 0) {
-        if (strcmp(args[0], "last") == 0) {
+        window = NULL;
+
+        if (strcmp(args[0], "focus") == 0 && MacroFocusWindow() != NULL) {
+            window = MacroFocusWindow();
+            focus = True;
+        }
+        else if (strcmp(args[0], "last") == 0) {
             window = WindowList;
         }
         else if (strcmp(args[0], "first") == 0) {
@@ -3813,35 +3820,34 @@
                 }
             }
         }
-        else {
-            if (sscanf(args[0], "%d", &windowIndex) == 1) {
-                if (windowIndex > 0) {
-                    for (window = WindowList; window != NULL && windowIndex > 1;
-                        --windowIndex) {
-                        window = window->next;
-                    }
+        else if (sscanf(args[0], "%d%1s", &windowIndex, dummy) == 1) {
+            if (windowIndex > 0) {
+                for (window = WindowList; window != NULL && windowIndex > 1;
+                    --windowIndex) {
+                    window = window->next;
                 }
-                else if (windowIndex < 0) {
-                    for (window = WindowList; window != NULL;
-                        window = window->next) {
-                        ++windowIndex;
-                    }
-                    if (windowIndex >= 0) {
-                        for (window = WindowList; window != NULL &&
-                            windowIndex > 0; window = window->next) {
-                            --windowIndex;
-                        }
-                    }
-                    else {
-                        window = NULL;
-                    }
+            }
+            else if (windowIndex < 0) {
+                for (window = WindowList; window != NULL;
+                    window = window->next) {
+                    ++windowIndex;
                 }
-                else {
-                    window = NULL;
+                if (windowIndex >= 0) {
+                    for (window = WindowList; window != NULL &&
+                        windowIndex > 0; window = window->next) {
+                        --windowIndex;
+                    }
                 }
             }
-            else {
-                window = NULL;
+        }
+        else {
+            /* we assume args[0] is a file_path/file_name string */
+            char fullname[MAXPATHLEN];
+            for (window = WindowList; window != NULL; window = window->next) {
+                sprintf(fullname, "%s%s", window->path, window->filename);
+                if (strcmp(args[0], fullname) == 0) {
+                    break;
+                }
             }
         }
 
@@ -3854,6 +3860,10 @@
             }
         }
     }
+    else if (MacroFocusWindow() != NULL) {
+        window = MacroFocusWindow();
+    }
+
     if (window != NULL) {
         RaiseFocusDocumentWindow(window, focus);
     }
