extend-for-key-in-array-syntax: update to key=val syntax
[nedit-bw.git] / enhanced-hooks-fix.patch
blob00187f3cfca8ced212ae06b25b28fc00e27d7f77
1 ---
3 source/macro.c | 12 +++++++++---
4 source/macro.h | 2 +-
5 source/nedit.h | 1 +
6 source/window.c | 6 ++++++
7 4 files changed, 17 insertions(+), 4 deletions(-)
9 diff --quilt old/source/macro.c new/source/macro.c
10 --- old/source/macro.c
11 +++ new/source/macro.c
12 @@ -1279,12 +1279,14 @@ static void finishMacroCmdExecution(Wind
13 void SafeGC(void)
15 WindowInfo *win;
17 for (win=WindowList; win!=NULL; win=win->next)
18 - if (win->macroCmdData != NULL || InSmartIndentMacros(win))
19 - return;
20 + if (win->macroCmdData != NULL
21 + || InSmartIndentMacros(win)
22 + || win->inMacroHook)
23 + return;
24 GarbageCollectStrings();
28 ** Executes macro string "macro" using the lastFocus pane in "window".
29 @@ -6045,11 +6047,11 @@ static int readStringArg(DataValue dv, c
30 *errMsg = "%s called with unknown object";
31 return False;
34 /* rough hack */
35 -void MacroApplyHook(const WindowInfo* document, const char* hook, int argc,
36 +void MacroApplyHook(WindowInfo* document, const char* hook, int argc,
37 DataValue* argv, DataValue* resultDV)
39 Symbol* hookSymbol;
41 hookSymbol = LookupSymbol(hook);
42 @@ -6059,10 +6061,12 @@ void MacroApplyHook(const WindowInfo* do
43 DataValue dummyResultDV; /* Passed to ExecuteMacro() if no result requested */
44 int status;
45 char* errMsg;
46 // char statusT[1024];
48 + document->inMacroHook = True;
50 /* Let 'er rip */
51 status = ExecuteMacro((WindowInfo*) document, hookProg, argc, argv,
52 (NULL == resultDV) ? &dummyResultDV : resultDV, &restartData,
53 &errMsg);
54 // switch (status)
55 @@ -6082,7 +6086,9 @@ void MacroApplyHook(const WindowInfo* do
56 if (MACRO_PREEMPT == status || MACRO_ERROR == status) {
57 fprintf(stderr, "nedit: \"%s\" error: %s\n", hook, (MACRO_ERROR == status) ? errMsg : "No dialogs");
58 } else {
59 /* Macro is done here */
62 + document->inMacroHook = False;
65 diff --quilt old/source/nedit.h new/source/nedit.h
66 --- old/source/nedit.h
67 +++ new/source/nedit.h
68 @@ -567,10 +567,11 @@ typedef struct _WindowInfo {
69 UserMenuCache *userMenuCache; /* cache user menus: */
70 UserBGMenuCache userBGMenuCache; /* shell & macro menu are shared over all
71 "tabbed" documents, while each document
72 has its own background menu. */
73 Boolean transient;
74 + Boolean inMacroHook; /* to protect GC */
75 } WindowInfo;
77 extern WindowInfo *WindowList;
78 extern Display *TheDisplay;
79 extern Widget TheAppShell;
80 diff --quilt old/source/window.c new/source/window.c
81 --- old/source/window.c
82 +++ new/source/window.c
83 @@ -265,10 +265,11 @@ WindowInfo *CreateWindow(const char *nam
84 window->autoSaveOpCount = 0;
85 window->undoOpCount = 0;
86 window->undoMemUsed = 0;
87 CLEAR_ALL_LOCKS(window->lockReasons);
88 window->transient = False;
89 + window->inMacroHook = False;
90 window->indentStyle = GetPrefAutoIndent(PLAIN_LANGUAGE_MODE);
91 window->autoSave = GetPrefAutoSave();
92 window->saveOldVersion = GetPrefSaveOldVersion();
93 window->wrapMode = GetPrefWrap(PLAIN_LANGUAGE_MODE);
94 window->showWrapMargin = GetPrefShowWrapMargin();
95 @@ -1011,10 +1012,14 @@ void CloseWindow(WindowInfo *window)
96 RefreshTabState(window);
97 updateLineNumDisp(window);
98 return;
101 + if (window->inMacroHook) {
102 + fprintf(stderr, "NEdit: warning closing window while in MacroHook\n");
105 /* Free syntax highlighting patterns, if any. w/o redisplaying */
106 FreeHighlightingData(window);
108 /* remove the buffer modification callbacks so the buffer will be
109 deallocated when the last text widget is destroyed */
110 @@ -3371,10 +3376,11 @@ WindowInfo* CreateDocument(WindowInfo* s
111 window->autoSaveOpCount = 0;
112 window->undoOpCount = 0;
113 window->undoMemUsed = 0;
114 CLEAR_ALL_LOCKS(window->lockReasons);
115 window->transient = False;
116 + window->inMacroHook = False;
117 window->indentStyle = GetPrefAutoIndent(PLAIN_LANGUAGE_MODE);
118 window->autoSave = GetPrefAutoSave();
119 window->saveOldVersion = GetPrefSaveOldVersion();
120 window->wrapMode = GetPrefWrap(PLAIN_LANGUAGE_MODE);
121 window->showWrapMargin = GetPrefShowWrapMargin();
122 diff --quilt old/source/macro.h new/source/macro.h
123 --- old/source/macro.h
124 +++ new/source/macro.h
125 @@ -72,9 +72,9 @@ int CheckMacroString(Widget dialogParent
126 char **errPos);
127 char *GetReplayMacro(void);
128 void ReadMacroInitFile(WindowInfo *window);
129 void ReturnShellCommandOutput(WindowInfo *window, const char *outText, int status);
130 struct DataValueTag;
131 -void MacroApplyHook(const WindowInfo* document, const char *hook, int argc,
132 +void MacroApplyHook(WindowInfo* document, const char *hook, int argc,
133 struct DataValueTag* argv, struct DataValueTag* resultDV);
135 #endif /* NEDIT_MACRO_H_INCLUDED */