fix 'nedit file' segfaults
[nedit-bw.git] / enhanced-hooks-renaming.patch
blobf55333472689537e4a2199d8d0407e8d1cdfabf7
1 ---
3 doc/help.etx | 4 ++--
4 source/file.c | 2 +-
5 source/menu.c | 2 +-
6 source/selection.c | 2 +-
7 4 files changed, 5 insertions(+), 5 deletions(-)
9 diff --quilt old/source/menu.c new/source/menu.c
10 --- old/source/menu.c
11 +++ new/source/menu.c
12 @@ -2894,11 +2894,11 @@ static void openAP(Widget w, XEvent *eve
13 return;
16 fileNameArg.tag = STRING_TAG;
17 AllocNStringNCpy(&fileNameArg.val.str, args[0], MAXPATHLEN);
18 - hook_successful = MacroApplyHook(window, "file_name_hook",
19 + hook_successful = MacroApplyHook(window, "pre_open_hook",
20 1, &fileNameArg, &resultDV);
22 if (hook_successful && resultDV.tag == STRING_TAG) {
23 fileNameToOpen = resultDV.val.str.rep;
24 } else {
25 diff --quilt old/source/file.c new/source/file.c
26 --- old/source/file.c
27 +++ new/source/file.c
28 @@ -265,11 +265,11 @@ WindowInfo *EditExistingFile(WindowInfo
29 if(GetPrefAlwaysCheckRelTagsSpecs())
30 AddRelTagsFile(GetPrefTagFile(), path, TAG);
31 AddToPrevOpenMenu(fullname);
33 /* file_open_hook() */
34 - MacroApplyHook(window, "file_open_hook", 0, NULL, NULL);
35 + MacroApplyHook(window, "post_open_hook", 0, NULL, NULL);
37 return window;
40 void RevertToSaved(WindowInfo *window)
41 diff --quilt old/source/selection.c new/source/selection.c
42 --- old/source/selection.c
43 +++ new/source/selection.c
44 @@ -364,11 +364,11 @@ static void fileCB(Widget widget, Window
45 Boolean hook_successful = False;
46 char *fileNameToOpen;
48 fileNameArg.tag = STRING_TAG;
49 AllocNStringNCpy(&fileNameArg.val.str, globbuf.gl_pathv[i], MAXPATHLEN);
50 - hook_successful = MacroApplyHook(window, "file_name_hook",
51 + hook_successful = MacroApplyHook(window, "pre_open_hook",
52 1, &fileNameArg, &resultDV);
54 if (hook_successful && resultDV.tag == STRING_TAG) {
55 fileNameToOpen = resultDV.val.str.rep;
56 } else {
57 diff --quilt old/doc/help.etx new/doc/help.etx
58 --- old/doc/help.etx
59 +++ new/doc/help.etx
60 @@ -3774,14 +3774,14 @@ Hooks
61 is called.
63 You don't have to provide any hook. If a certain hook does not exist, it is
64 simply skipped.
66 -**file_open_hook()**
67 +**post_open_hook()**
68 Called when an existing file is opened.
70 -**file_name_hook(~filename~)**
71 +**pre_open_hook(~filename~)**
72 Called before NEdit opens a file using a certain name. The parameter is
73 the filename NEdit intends to open.
75 Return a string to use instead of the original filename. Return 0 to tell
76 NEdit to use the original filename.