3 doc/help.etx | 18 +++++++++++
4 source/file.c | 74 +++++++++++++++++++++++++++++++++----------------
6 source/highlightData.c | 4 +-
7 source/macro.c | 14 +++++++++
8 source/menu.c | 51 +++++++++++++++++++++++++++++----
11 source/server.c | 5 +--
13 source/window.c | 18 ++++++++---
14 source/windowTitle.c | 51 ++++++++++++++++++++++++++-------
15 source/windowTitle.h | 1
16 13 files changed, 192 insertions(+), 55 deletions(-)
18 diff --quilt old/doc/help.etx new/doc/help.etx
21 @@ -3241,11 +3241,11 @@ Action Routines
22 3>Menu Action Routine Arguments
24 Arguments are text strings enclosed in quotes. Below are the menu action
25 routines which take arguments. Optional arguments are enclosed in [].
27 - **new**( ["tab" | "window" | "prefs" | "opposite"] )
28 + **new**( ["tab" | "window" | "prefs" | "opposite"] [, "transient"] )
30 **close**( ["prompt" | "save" | "nosave"] )
32 **execute_command**( shell-command )
34 @@ -3308,10 +3308,19 @@ Action Routines
36 "opposite": Opposite of user's tab/window
38 Default behaviour is "prefs".
40 + "transient" [EXPERIMENTAL]: Open the new
41 + document in transient mode. This disables the
42 + warning NEdit usually gives when you try to
43 + close a file which is not saved.
45 + WARNING: This is an experimental feature.
46 + Make sure to use this setting only for
47 + documents which can easily be recreated.
49 ~filename~ Path names are relative to the directory from
50 which NEdit was started. Shell interpreted
51 wildcards and `~' are not expanded.
53 ~keep-dialog~ Either "keep" or "nokeep".
54 @@ -3942,10 +3951,17 @@ Preferences
56 Lock the file against accidental modification. This temporarily prevents the
57 file from being modified in this NEdit session. Note that this is different
58 from setting the file protection.
60 +**Transient [EXPERIMENTAL]**
61 + Flags the document as transient. This disables the warning NEdit usually
62 + gives when you try to close a file which is not saved.
64 + WARNING: This is an experimental feature. Make sure to use this setting
65 + only for documents which can easily be recreated.
67 3>Preferences -> Default Settings Menu
69 Options in the Preferences -> Default Settings menu have the same meaning as
70 those in the top-level Preferences menu, except that they apply to future
71 NEdit windows and future NEdit sessions if saved with the Save Defaults
72 diff --quilt old/source/file.h new/source/file.h
76 #define PROMPT_SBC_DIALOG_RESPONSE 0
77 #define YES_SBC_DIALOG_RESPONSE 1
78 #define NO_SBC_DIALOG_RESPONSE 2
80 WindowInfo *EditNewFile(WindowInfo *inWindow, char *geometry, int iconic,
81 - const char *languageMode, const char *defaultPath);
82 + const char *languageMode, const char *defaultPath, Boolean transient);
83 WindowInfo *EditExistingFile(WindowInfo *inWindow, const char *name,
84 const char *path, int flags, char *geometry, int iconic,
85 const char *languageMode, int tabbed, int bgOpen);
86 void RevertToSaved(WindowInfo *window);
87 int SaveWindow(WindowInfo *window);
88 @@ -58,9 +58,9 @@ int IncludeFile(WindowInfo *window, cons
89 int PromptForExistingFile(WindowInfo *window, char *prompt, char *fullname);
90 int PromptForNewFile(WindowInfo *window, char *prompt, char *fullname,
91 int *fileFormat, int *addWrap);
92 int CheckReadOnly(WindowInfo *window);
93 void RemoveBackupFile(WindowInfo *window);
94 -void UniqueUntitledName(char *name);
95 +void UniqueUntitledName(char *name, Boolean transient);
96 void CheckForChangesToFile(WindowInfo *window);
98 #endif /* NEDIT_FILE_H_INCLUDED */
99 diff --quilt old/source/file.c new/source/file.c
100 --- old/source/file.c
101 +++ new/source/file.c
102 @@ -108,21 +108,21 @@ static void forceShowLineNumbers(WindowI
104 void removeVersionNumber(char *fileName);
107 WindowInfo *EditNewFile(WindowInfo *inWindow, char *geometry, int iconic,
108 - const char *languageMode, const char *defaultPath)
109 + const char *languageMode, const char *defaultPath, Boolean transient)
111 char name[MAXPATHLEN];
116 /*... test for creatability? */
118 /* Find a (relatively) unique name for the new file */
119 - UniqueUntitledName(name);
120 + UniqueUntitledName(name, transient);
122 /* create new window/document */
124 window = CreateDocument(inWindow, name);
126 @@ -167,10 +167,18 @@ WindowInfo *EditNewFile(WindowInfo *inWi
127 if (iconic && IsIconic(window))
128 RaiseDocument(window);
130 RaiseDocumentWindow(window);
133 + /* Set the window to transient mode. */
134 + String apParams[1];
137 + XtCallActionProc(window->lastFocus, "set_transient", NULL, apParams, 1);
145 @@ -730,21 +738,26 @@ int CloseFileAndWindow(WindowInfo *windo
147 /* Make sure that the window is not in iconified state */
148 if (window->fileChanged)
149 RaiseDocumentWindow(window);
151 - /* If the window is a normal & unmodified file or an empty new file,
152 - or if the user wants to ignore external modifications then
153 - just close it. Otherwise ask for confirmation first. */
154 - if (!window->fileChanged &&
155 + /* If the document is transient, belongs to a normal & unmodified file
156 + or is empty and unchanged, or if the user wants to ignore external
157 + modifications then just close it. Otherwise ask for confirmation
161 + window->transient ||
162 + (!window->fileChanged &&
164 ((!window->fileMissing && window->lastModTime > 0) ||
166 (window->fileMissing && window->lastModTime == 0) ||
167 /* File deleted/modified externally, ignored by user. */
168 - !GetPrefWarnFileMods()))
169 + !GetPrefWarnFileMods())))
171 + RemoveBackupFile(window);
173 /* up-to-date windows don't have outstanding backup files to close */
176 if (preResponse == PROMPT_SBC_DIALOG_RESPONSE)
177 @@ -1082,10 +1095,20 @@ static int doSave(WindowInfo *window)
178 window->fileMissing = TRUE;
183 + /* If the window was previously transient and the user saves it, than he
184 + obviously don't want the window to be transient anymore */
185 + if (window->transient) {
186 + /* Unset the window to transient mode. */
187 + String apParams[1];
190 + XtCallActionProc(window->lastFocus, "set_transient", NULL, apParams, 1);
193 /* call "post_save_hook" */
194 MacroApplyHook(window, "post_save_hook", 0, NULL, NULL);
198 @@ -1180,14 +1203,10 @@ int WriteBackupFile(WindowInfo *window)
200 void RemoveBackupFile(WindowInfo *window)
202 char name[MAXPATHLEN];
204 - /* Don't delete backup files when backups aren't activated. */
205 - if (window->autoSave == FALSE)
208 backupFileName(window, name, sizeof(name));
213 @@ -1612,28 +1631,35 @@ int PromptForNewFile(WindowInfo *window,
217 ** Find a name for an untitled file, unique in the name space of in the opened
218 ** files in this session, i.e. Untitled or Untitled_nn, and write it into
219 -** the string "name".
220 +** the string "name" (at least MAXPATHLEN).
222 -void UniqueUntitledName(char *name)
223 +void UniqueUntitledName(char *name, Boolean transient)
227 + const char *base = transient ? "Transient" : "Untitled";
229 + size_t baseLen = strlen(base);
230 + size_t totalSpace = MAXPATHLEN;
232 + snprintf(name, MAXPATHLEN, "%s", base);
233 + tail = name + baseLen;
234 + totalSpace -= baseLen;
238 + for (w = WindowList; w != NULL; w = w->next)
239 + if (!strcmp(w->filename, name))
244 - for (i=0; i<INT_MAX; i++) {
246 - sprintf(name, "Untitled");
248 - sprintf(name, "Untitled_%d", i);
249 - for (w=WindowList; w!=NULL; w=w->next)
250 - if (!strcmp(w->filename, name))
255 + snprintf(tail, totalSpace, "_%d", ++i);
256 + } while (i < INT_MAX);
260 ** Callback that guards us from trying to access a window after it has
261 ** been destroyed while a modal dialog is up.
262 diff --quilt old/source/highlightData.c new/source/highlightData.c
263 --- old/source/highlightData.c
264 +++ new/source/highlightData.c
265 @@ -546,14 +546,14 @@ static char *DefaultPatternSets[] = {
266 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
267 Logical operators:\"~|&|\\|\":::Text Arg2::}",
269 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
270 Comment:\"#\":\"$\"::Comment::\n\
271 - Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|args|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line|VERSION|NEDIT_HOME)>\":::Identifier::\n\
272 + Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|args|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line|transient|VERSION|NEDIT_HOME)>\":::Identifier::\n\
273 Built-in Pref Vars:\"(?<!\\Y)\\$(?:auto_indent|em_tab_dist|file_format|font_name|font_name_bold|font_name_bold_italic|font_name_italic|highlight_syntax|incremental_backup|incremental_search_line|make_backup_copy|match_syntax_based|overtype_mode|show_line_numbers|show_matching|statistics_line|tab_dist|use_tabs|wrap_margin|wrap_text)>\":::Identifier2::\n\
274 Built-in Special Vars:\"(?<!\\Y)\\$(?:[1-9]|list_dialog_button|n_args|read_status|search_end|shell_cmd_status|string_dialog_button|sub_sep)>\":::String1::\n\
275 - Built-in Subrs:\"<(?:append_file|beep|call|calltip|clipboard_to_string|dialog|filename_dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|highlight_calltip_line|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)(?=\\s*\\()\":::Subroutine::\n\
276 + Built-in Subrs:\"<(?:append_file|beep|call|calltip|clipboard_to_string|dialog|filename_dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|highlight_calltip_line|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_transient|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)(?=\\s*\\()\":::Subroutine::\n\
277 Menu Actions:\"<(?:new(?:_tab|_opposite)?|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-pane|split_pane|close-pane|close_pane|detach_document(?:_dialog)?|move_document_dialog|(?:next|previous|last)_document|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|post_tab_context_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()\":::Subroutine::\n\
278 Text Actions:\"<(?:self-insert|self_insert|grab-focus|grab_focus|extend-adjust|extend_adjust|extend-start|extend_start|extend-end|extend_end|secondary-adjust|secondary_adjust|secondary-or-drag-adjust|secondary_or_drag_adjust|secondary-start|secondary_start|secondary-or-drag-start|secondary_or_drag_start|process-bdrag|process_bdrag|move-destination|move_destination|move-to|move_to|move-to-or-end-drag|move_to_or_end_drag|end_drag|copy-to|copy_to|copy-to-or-end-drag|copy_to_or_end_drag|exchange|process-cancel|process_cancel|paste-clipboard|paste_clipboard|copy-clipboard|copy_clipboard|cut-clipboard|cut_clipboard|copy-primary|copy_primary|cut-primary|cut_primary|newline|newline-and-indent|newline_and_indent|newline-no-indent|newline_no_indent|delete-selection|delete_selection|delete-previous-character|delete_previous_character|delete-next-character|delete_next_character|delete-previous-word|delete_previous_word|delete-next-word|delete_next_word|delete-to-start-of-line|delete_to_start_of_line|delete-to-end-of-line|delete_to_end_of_line|forward-character|forward_character|backward-character|backward_character|key-select|key_select|process-up|process_up|process-down|process_down|process-shift-up|process_shift_up|process-shift-down|process_shift_down|process-home|process_home|forward-word|forward_word|backward-word|backward_word|forward-paragraph|forward_paragraph|backward-paragraph|backward_paragraph|beginning-of-line|beginning_of_line|end-of-line|end_of_line|beginning-of-file|beginning_of_file|end-of-file|end_of_file|next-page|next_page|previous-page|previous_page|page-left|page_left|page-right|page_right|toggle-overstrike|toggle_overstrike|scroll-up|scroll_up|scroll-down|scroll_down|scroll_left|scroll_right|scroll-to-line|scroll_to_line|select-all|select_all|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)(?=\\s*\\()\":::Subroutine::\n\
279 Macro Hooks:\"<(?:(?:pre|post)_(?:open|save)|cursor_moved|modified|(?:losing_)?focus)_hook(?=\\s*\\()\":::Subroutine1::\n\
280 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
281 Braces:\"[{}\\[\\]]\":::Keyword::\n\
282 diff --quilt old/source/windowTitle.c new/source/windowTitle.c
283 --- old/source/windowTitle.c
284 +++ new/source/windowTitle.c
285 @@ -99,10 +99,11 @@ static struct {
290 Widget oFileChangedW;
291 + Widget oTransientW;
293 Widget oFileReadOnlyW;
294 Widget oServerEqualViewW;
296 char filename[MAXPATHLEN];
297 @@ -111,15 +112,16 @@ static struct {
298 char serverName[MAXPATHLEN];
305 int suppressFormatUpdate;
306 } etDialog = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
307 - NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
308 - NULL,NULL,"","","","",0,0,0,0,0};
309 + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
310 + NULL,NULL,"","","","",0,0,0,0,0,0};
314 static char* removeSequence(char* sourcePtr, char c)
316 @@ -257,10 +259,11 @@ char *FormatWindowTitle(const char* file
317 const char* serverName,
323 const char* titleFormat)
325 static char title[WINDOWTITLE_MAX_LEN];
326 char *titlePtr = title;
327 char* titleEnd = title + WINDOWTITLE_MAX_LEN - 1;
328 @@ -359,18 +362,20 @@ char *FormatWindowTitle(const char* file
329 titlePtr = safeStrCpy(titlePtr, titleEnd, GetNameOfHost());
332 case 'S': /* file status */
333 fileStatusPresent = True;
334 - if (IS_ANY_LOCKED_IGNORING_USER(lockReasons) && fileChanged)
335 + if (IS_ANY_LOCKED_IGNORING_USER(lockReasons) && fileChanged && !transient)
336 titlePtr = safeStrCpy(titlePtr, titleEnd, "read only, modified");
337 else if (IS_ANY_LOCKED_IGNORING_USER(lockReasons))
338 titlePtr = safeStrCpy(titlePtr, titleEnd, "read only");
339 - else if (IS_USER_LOCKED(lockReasons) && fileChanged)
340 + else if (IS_USER_LOCKED(lockReasons) && fileChanged && !transient)
341 titlePtr = safeStrCpy(titlePtr, titleEnd, "locked, modified");
342 else if (IS_USER_LOCKED(lockReasons))
343 titlePtr = safeStrCpy(titlePtr, titleEnd, "locked");
344 + else if (transient)
345 + titlePtr = safeStrCpy(titlePtr, titleEnd, "transient");
346 else if (fileChanged)
347 titlePtr = safeStrCpy(titlePtr, titleEnd, "modified");
350 case 'u': /* user name */
351 @@ -386,18 +391,20 @@ char *FormatWindowTitle(const char* file
352 fileStatusPresent = True;
353 if (*titleFormat && *titleFormat == 'S')
357 - if (IS_ANY_LOCKED_IGNORING_USER(lockReasons) && fileChanged)
358 + if (IS_ANY_LOCKED_IGNORING_USER(lockReasons) && fileChanged && !transient)
359 titlePtr = safeStrCpy(titlePtr, titleEnd, "RO*");
360 else if (IS_ANY_LOCKED_IGNORING_USER(lockReasons))
361 titlePtr = safeStrCpy(titlePtr, titleEnd, "RO");
362 - else if (IS_USER_LOCKED(lockReasons) && fileChanged)
363 + else if (IS_USER_LOCKED(lockReasons) && fileChanged && !transient)
364 titlePtr = safeStrCpy(titlePtr, titleEnd, "LO*");
365 else if (IS_USER_LOCKED(lockReasons))
366 titlePtr = safeStrCpy(titlePtr, titleEnd, "LO");
367 + else if (transient)
368 + titlePtr = safeStrCpy(titlePtr, titleEnd, "TR");
369 else if (fileChanged)
370 titlePtr = safeStrCpy(titlePtr, titleEnd, "*");
374 @@ -462,10 +469,11 @@ char *FormatWindowTitle(const char* file
378 /* Enable/disable test buttons, depending on presence of codes */
379 XtSetSensitive(etDialog.oFileChangedW, fileStatusPresent);
380 + XtSetSensitive(etDialog.oTransientW, fileStatusPresent);
381 XtSetSensitive(etDialog.oFileReadOnlyW, fileStatusPresent);
382 XtSetSensitive(etDialog.oFileLockedW, fileStatusPresent &&
383 !IS_PERM_LOCKED(etDialog.lockReasons));
385 XtSetSensitive(etDialog.oServerNameW, serverNamePresent);
386 @@ -491,10 +499,12 @@ static void setToggleButtons(void)
388 XmToggleButtonSetState(etDialog.oDirW,
389 etDialog.filenameSet == True, False);
390 XmToggleButtonSetState(etDialog.oFileChangedW,
391 etDialog.fileChanged == True, False);
392 + XmToggleButtonSetState(etDialog.oTransientW,
393 + etDialog.transient == True, False);
394 XmToggleButtonSetState(etDialog.oFileReadOnlyW,
395 IS_PERM_LOCKED(etDialog.lockReasons), False);
396 XmToggleButtonSetState(etDialog.oFileLockedW,
397 IS_USER_LOCKED(etDialog.lockReasons), False);
398 /* Read-only takes precedence on locked */
399 @@ -557,10 +567,11 @@ static void formatChangedCB(Widget w, Xt
403 etDialog.lockReasons,
404 XmToggleButtonGetState(etDialog.oFileChangedW),
405 + XmToggleButtonGetState(etDialog.oTransientW),
408 XmTextFieldSetString(etDialog.previewW, title);
411 @@ -587,10 +598,16 @@ static void fileChangedCB(Widget w, XtPo
413 etDialog.fileChanged = XmToggleButtonGetState(w);
414 formatChangedCB(w, clientData, callData);
417 +static void transientCB(Widget w, XtPointer clientData, XtPointer callData)
419 + etDialog.transient = XmToggleButtonGetState(w);
420 + formatChangedCB(w, clientData, callData);
423 static void fileLockedCB(Widget w, XtPointer clientData, XtPointer callData)
425 SET_USER_LOCKED(etDialog.lockReasons, XmToggleButtonGetState(w));
426 formatChangedCB(w, clientData, callData);
428 @@ -1274,39 +1291,50 @@ static void createEditTitleDialog(Widget
429 XmNtopWidget, testLbl,
430 XmNlabelString, s1=XmStringCreateSimple("File modified"),
431 XmNmnemonic, 'o', NULL);
432 XtAddCallback(etDialog.oFileChangedW, XmNvalueChangedCallback, fileChangedCB, NULL);
435 - etDialog.oFileReadOnlyW = XtVaCreateManagedWidget("fileReadOnly",
436 - xmToggleButtonWidgetClass, previewBox,
438 + etDialog.oTransientW = XtVaCreateManagedWidget("transient",
439 + xmToggleButtonWidgetClass, previewBox,
440 XmNleftAttachment, XmATTACH_WIDGET,
441 XmNleftWidget, etDialog.oFileChangedW,
442 XmNtopAttachment, XmATTACH_WIDGET,
443 XmNtopWidget, testLbl,
444 + XmNlabelString, s1=XmStringCreateSimple("File transient"),
445 + XmNmnemonic, 't', NULL);
446 + XtAddCallback(etDialog.oTransientW, XmNvalueChangedCallback, transientCB, NULL);
449 + etDialog.oFileReadOnlyW = XtVaCreateManagedWidget("fileReadOnly",
450 + xmToggleButtonWidgetClass, previewBox,
451 + XmNleftAttachment, XmATTACH_POSITION,
452 + XmNleftPosition, RADIO_INDENT,
453 + XmNtopAttachment, XmATTACH_WIDGET,
454 + XmNtopWidget, etDialog.oFileChangedW,
455 XmNlabelString, s1=XmStringCreateSimple("File read only"),
456 XmNmnemonic, 'n', NULL);
457 XtAddCallback(etDialog.oFileReadOnlyW, XmNvalueChangedCallback, fileReadOnlyCB, NULL);
460 etDialog.oFileLockedW = XtVaCreateManagedWidget("fileLocked",
461 xmToggleButtonWidgetClass, previewBox,
462 XmNleftAttachment, XmATTACH_WIDGET,
463 XmNleftWidget, etDialog.oFileReadOnlyW,
464 XmNtopAttachment, XmATTACH_WIDGET,
465 - XmNtopWidget, testLbl,
466 + XmNtopWidget, etDialog.oFileChangedW,
467 XmNlabelString, s1=XmStringCreateSimple("File locked"),
468 XmNmnemonic, 'l', NULL);
469 XtAddCallback(etDialog.oFileLockedW, XmNvalueChangedCallback, fileLockedCB, NULL);
472 etDialog.oServerNameW = XtVaCreateManagedWidget("servernameSet",
473 xmToggleButtonWidgetClass, previewBox,
474 XmNleftAttachment, XmATTACH_POSITION,
475 XmNleftPosition, RADIO_INDENT,
476 XmNtopAttachment, XmATTACH_WIDGET,
477 - XmNtopWidget, etDialog.oFileChangedW,
478 + XmNtopWidget, etDialog.oFileReadOnlyW,
479 XmNlabelString, s1=XmStringCreateSimple("Server name present"),
480 XmNmnemonic, 'v', NULL);
481 XtAddCallback(etDialog.oServerNameW, XmNvalueChangedCallback, serverNameCB, NULL);
484 @@ -1455,10 +1483,11 @@ void EditCustomTitleFormat(WindowInfo *w
486 etDialog.isServer = IsServer;
487 etDialog.filenameSet = window->filenameSet;
488 etDialog.lockReasons = window->lockReasons;
489 etDialog.fileChanged = window->fileChanged;
490 + etDialog.transient = window->transient;
492 if (etDialog.window != window && etDialog.form)
494 /* Destroy the dialog owned by the other window.
495 Note: don't rely on the destroy event handler to reset the
496 diff --quilt old/source/windowTitle.h new/source/windowTitle.h
497 --- old/source/windowTitle.h
498 +++ new/source/windowTitle.h
499 @@ -40,10 +40,11 @@ char *FormatWindowTitle(const char* file
500 const char* serverName,
506 const char* titleFormat);
508 void EditCustomTitleFormat(WindowInfo *window);
510 #endif /* NEDIT_WINDOWTITLE_H_INCLUDED */
511 diff --quilt old/source/macro.c new/source/macro.c
512 --- old/source/macro.c
513 +++ new/source/macro.c
514 @@ -376,10 +376,12 @@ static int rangesetListMV(WindowInfo *wi
515 int nArgs, DataValue *result, char **errMsg);
516 static int versionMV(WindowInfo* window, DataValue* argList, int nArgs,
517 DataValue* result, char** errMsg);
518 static int neditHomeMV(WindowInfo *window, DataValue *argList, int nArgs,
519 DataValue *result, char **errMsg);
520 +static int transientMV(WindowInfo *window, DataValue *argList, int nArgs,
521 + DataValue *result, char **errMsg);
522 static int rangesetCreateMS(WindowInfo *window, DataValue *argList, int nArgs,
523 DataValue *result, char **errMsg);
524 static int rangesetDestroyMS(WindowInfo *window, DataValue *argList, int nArgs,
525 DataValue *result, char **errMsg);
526 static int rangesetGetByNameMS(WindowInfo *window, DataValue *argList, int nArgs,
527 @@ -536,10 +538,11 @@ static const BuiltInSubrName SpecialVars
528 { "$backlight_string", backlightStringMV },
530 { "$rangeset_list", rangesetListMV },
531 { "$VERSION", versionMV },
532 { "$NEDIT_HOME", neditHomeMV },
533 + { "$transient", transientMV },
534 { NULL, NULL } /* sentinel */
537 /* Global symbols for "returning" secondary values from built-in functions */
538 static int STRING_DIALOG_BUTTON, SEARCH_END, READ_STATUS,
539 @@ -4852,10 +4855,21 @@ static int neditHomeMV(WindowInfo *windo
545 +** Returns the transient status of the current window
547 +static int transientMV(WindowInfo *window, DataValue *argList, int nArgs,
548 + DataValue *result, char **errMsg)
550 + result->tag = INT_TAG;
551 + result->val.n = !!window->transient;
556 ** Built-in macro subroutine to create a new rangeset or rangesets.
557 ** If called with one argument: $1 is the number of rangesets required and
558 ** return value is an array indexed 0 to n, with the rangeset labels as values;
559 ** (or an empty array if the requested number of rangesets are not available).
560 ** If called with no arguments, returns a single rangeset label (not an array),
561 diff --quilt old/source/menu.c new/source/menu.c
562 --- old/source/menu.c
563 +++ new/source/menu.c
564 @@ -413,10 +413,12 @@ static void setMatchSyntaxBasedAP(Widget
566 static void setOvertypeModeAP(Widget w, XEvent *event, String *args,
568 static void setLockedAP(Widget w, XEvent *event, String *args,
570 +static void setTransientAP(Widget text, XEvent *event, String *args,
572 static void setUseTabsAP(Widget w, XEvent *event, String *args,
574 static void setEmTabDistAP(Widget w, XEvent *event, String *args,
576 static void setTabDistAP(Widget w, XEvent *event, String *args,
577 @@ -583,10 +585,11 @@ static XtActionsRec Actions[] = {
578 {"set_incremental_backup", setIncrementalBackupAP},
579 {"set_show_matching", setShowMatchingAP},
580 {"set_match_syntax_based", setMatchSyntaxBasedAP},
581 {"set_overtype_mode", setOvertypeModeAP},
582 {"set_locked", setLockedAP},
583 + {"set_transient", setTransientAP},
584 {"set_tab_dist", setTabDistAP},
585 {"set_em_tab_dist", setEmTabDistAP},
586 {"set_use_tabs", setUseTabsAP},
587 {"set_fonts", setFontsAP},
588 {"set_language_mode", setLanguageModeAP}
589 @@ -768,10 +771,12 @@ Widget CreateMenuBar(Widget parent, Wind
590 createMenuSeparator(menuPane, "sep4", SHORT);
591 window->overtypeModeItem = createMenuToggle(menuPane, "overtype", "Overtype", 'O',
592 doActionCB, "set_overtype_mode", False, SHORT);
593 window->readOnlyItem = createMenuToggle(menuPane, "readOnly", "Read Only",
594 'y', doActionCB, "set_locked", IS_USER_LOCKED(window->lockReasons), FULL);
595 + window->transientItem = createMenuToggle(menuPane, "transient", "Transient",
596 + 'r', doActionCB, "set_transient", window->transient, FULL);
600 ** "Search" pull down menu.
602 @@ -1158,10 +1163,12 @@ Widget CreateMenuBar(Widget parent, Wind
603 createMenuSeparator(menuPane, "sep2", SHORT);
604 window->overtypeModeItem = createMenuToggle(menuPane, "overtype", "Overtype", 'O',
605 doActionCB, "set_overtype_mode", False, SHORT);
606 window->readOnlyItem = createMenuToggle(menuPane, "readOnly", "Read Only",
607 'y', doActionCB, "set_locked", IS_USER_LOCKED(window->lockReasons), FULL);
608 + window->transientItem = createMenuToggle(menuPane, "transient", "Transient",
609 + 'r', doActionCB, "set_transient", window->transient, FULL);
614 ** Create the Shell menu
615 @@ -2780,10 +2787,11 @@ static void unloadTipsFileMenuCB(Widget
617 static void newAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
619 WindowInfo *window = WidgetToWindow(w);
620 int openInTab = GetPrefOpenInTab();
621 + Boolean transient = False;
624 if (strcmp(args[0], "prefs") == 0) {
625 /* accept default */;
627 @@ -2794,16 +2802,25 @@ static void newAP(Widget w, XEvent *even
630 else if (strcmp(args[0], "opposite") == 0) {
631 openInTab = !openInTab;
633 + else if (strcmp(args[0], "transient") == 0) {
637 fprintf(stderr, "nedit: Unknown argument to action procedure \"new\": %s\n", args[0]);
641 - EditNewFile(openInTab? window : NULL, NULL, False, NULL, window->path);
642 + /* Catch transient if it comes after a window type argument. */
643 + if (2 == *nArgs && strcmp(args[1], "transient") == 0) {
647 + EditNewFile(openInTab? window : NULL, NULL, False, NULL, window->path,
653 ** These are just here because our techniques make it hard to bind a menu item
654 @@ -2813,18 +2830,18 @@ static void newAP(Widget w, XEvent *even
655 static void newOppositeAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
657 WindowInfo *window = WidgetToWindow(w);
659 EditNewFile(GetPrefOpenInTab()? NULL : window, NULL, False, NULL,
661 + window->path, False);
664 static void newTabAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
666 WindowInfo *window = WidgetToWindow(w);
668 - EditNewFile(window, NULL, False, NULL, window->path);
669 + EditNewFile(window, NULL, False, NULL, window->path, False);
673 static void openDialogAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
675 @@ -2956,11 +2973,11 @@ static void revertDialogAP(Widget w, XEv
677 WindowInfo *window = WidgetToWindow(w);
680 /* re-reading file is irreversible, prompt the user first */
681 - if (window->fileChanged)
682 + if (window->fileChanged && !window->transient)
684 b = DialogF(DF_QUES, window->shell, 2, "Discard Changes",
685 "Discard changes to\n%s%s?", "OK", "Cancel", window->path,
688 @@ -3184,11 +3201,12 @@ static void exitAP(Widget w, XEvent *eve
689 user really wants to exit */
692 strcpy(ptr, "Editing: "); ptr += 9; lineLen += 9;
693 for (win=WindowList; win!=NULL; win=win->next) {
694 - sprintf(filename, "%s%s", win->filename, win->fileChanged? "*": "");
695 + sprintf(filename, "%s%s", win->filename,
696 + (win->fileChanged && !win->transient) ? "*": "");
698 titleLen = strlen(title);
699 if (ptr - exitMsg + titleLen + 30 >= DF_MAX_MSG_LENGTH) {
700 strcpy(ptr, "..."); ptr += 3;
702 @@ -4312,10 +4330,31 @@ static void setLockedAP(Widget w, XEvent
703 XmToggleButtonSetState(window->readOnlyItem, IS_ANY_LOCKED(window->lockReasons), False);
704 UpdateWindowTitle(window);
705 UpdateWindowReadOnly(window);
709 +** Action procedure for setting or toggling the transient flag.
711 +static void setTransientAP(Widget text, XEvent *event, String *args,
714 + WindowInfo *window = WidgetToWindow(text);
717 + ACTION_BOOL_PARAM_OR_TOGGLE(newState, *nArgs, args,
718 + window->transient, "set_transient");
720 + window->transient = newState;
721 + if (IsTopDocument(window)) {
722 + XmToggleButtonSetState(window->transientItem, window->transient, False);
725 + UpdateWindowTitle(window);
726 + RefreshTabState(window);
729 static void setTabDistAP(Widget w, XEvent *event, String *args,
732 WindowInfo *window = WidgetToWindow(w);
734 @@ -4697,11 +4736,11 @@ void AddToPrevOpenMenu(const char *filen
735 static char* getWindowsMenuEntry(const WindowInfo* window)
737 static char fullTitle[MAXPATHLEN * 2 + 3+ 1];
739 sprintf(fullTitle, "%s%s", window->filename,
740 - window->fileChanged? "*" : "");
741 + (window->fileChanged && !window->transient) ? "*" : "");
743 if (GetPrefShowPathInWindowsMenu() && window->filenameSet)
745 strcat(fullTitle, " - ");
746 strcat(fullTitle, window->path);
747 diff --quilt old/source/nedit.h new/source/nedit.h
748 --- old/source/nedit.h
749 +++ new/source/nedit.h
750 @@ -330,10 +330,11 @@ typedef struct _WindowInfo {
751 Widget replaceMultiFileList;
752 Widget replaceMultiFilePathBtn;
753 Widget fontDialog; /* NULL, unless font dialog is up */
754 Widget colorDialog; /* NULL, unless color dialog is up */
755 Widget readOnlyItem; /* menu bar settable widgets... */
756 + Widget transientItem;
760 Widget newOppositeItem;
762 @@ -497,10 +498,11 @@ typedef struct _WindowInfo {
763 of selection related menu items */
764 Boolean filenameSet; /* is the window still "Untitled"? */
765 Boolean fileChanged; /* has window been modified? */
766 Boolean fileMissing; /* is the window's file gone? */
767 int lockReasons; /* all ways a file can be locked */
768 + Boolean transient; /* buffer is transient */
769 Boolean autoSave; /* is autosave turned on? */
770 Boolean saveOldVersion; /* keep old version in filename.bck */
771 char indentStyle; /* whether/how to auto indent */
772 char wrapMode; /* line wrap style: NO_WRAP,
773 NEWLINE_WRAP or CONTINUOUS_WRAP */
774 diff --quilt old/source/window.c new/source/window.c
775 --- old/source/window.c
776 +++ new/source/window.c
777 @@ -267,10 +267,11 @@ WindowInfo *CreateWindow(const char *nam
778 window->autoSaveCharCount = 0;
779 window->autoSaveOpCount = 0;
780 window->undoOpCount = 0;
781 window->undoMemUsed = 0;
782 CLEAR_ALL_LOCKS(window->lockReasons);
783 + window->transient = False;
784 window->indentStyle = GetPrefAutoIndent(PLAIN_LANGUAGE_MODE);
785 window->autoSave = GetPrefAutoSave();
786 window->saveOldVersion = GetPrefSaveOldVersion();
787 window->wrapMode = GetPrefWrap(PLAIN_LANGUAGE_MODE);
788 window->showWrapMargin = GetPrefShowWrapMargin();
789 @@ -995,12 +996,13 @@ void CloseWindow(WindowInfo *window)
791 /* if this is the last window, or must be kept alive temporarily because
792 it's running the macro calling us, don't close it, make it Untitled */
793 if (keepWindow || (WindowList == window && window->next == NULL)) {
794 window->filename[0] = '\0';
795 - UniqueUntitledName(name);
796 + UniqueUntitledName(name, False);
797 CLEAR_ALL_LOCKS(window->lockReasons);
798 + window->transient = False;
799 window->fileMode = 0;
802 strcpy(window->filename, name);
803 strcpy(window->path, "");
804 @@ -2109,16 +2111,17 @@ void UpdateWindowTitle(const WindowInfo
811 GetPrefTitleFormat());
813 iconTitle = XtMalloc(strlen(window->filename) + 2); /* strlen("*")+1 */
815 strcpy(iconTitle, window->filename);
816 - if (window->fileChanged)
817 + if (window->fileChanged && !window->transient)
818 strcat(iconTitle, "*");
819 XtVaSetValues(window->shell, XmNtitle, title, XmNiconName, iconTitle, NULL);
821 /* If there's a find or replace dialog up in "Keep Up" mode, with a
822 file name in the title, update it too */
823 @@ -2443,11 +2446,12 @@ static void modifiedCB(int pos, int nIns
824 SaveUndoInformation(window, pos, nInserted, nDeleted, deletedText);
826 /* Trigger automatic backup if operation or character limits reached */
827 if (window->autoSave &&
828 (window->autoSaveCharCount > AUTOSAVE_CHAR_LIMIT ||
829 - window->autoSaveOpCount > AUTOSAVE_OP_LIMIT)) {
830 + window->autoSaveOpCount > AUTOSAVE_OP_LIMIT)
831 + && !window->transient) {
832 WriteBackupFile(window);
833 window->autoSaveCharCount = 0;
834 window->autoSaveOpCount = 0;
837 @@ -3439,10 +3443,11 @@ WindowInfo* CreateDocument(WindowInfo* s
838 window->autoSaveCharCount = 0;
839 window->autoSaveOpCount = 0;
840 window->undoOpCount = 0;
841 window->undoMemUsed = 0;
842 CLEAR_ALL_LOCKS(window->lockReasons);
843 + window->transient = False;
844 window->indentStyle = GetPrefAutoIndent(PLAIN_LANGUAGE_MODE);
845 window->autoSave = GetPrefAutoSave();
846 window->saveOldVersion = GetPrefSaveOldVersion();
847 window->wrapMode = GetPrefWrap(PLAIN_LANGUAGE_MODE);
848 window->showWrapMargin = GetPrefShowWrapMargin();
849 @@ -3728,22 +3733,23 @@ void RefreshTabState(WindowInfo *win)
851 XmString s1, tipString;
852 char labelString[MAXPATHLEN];
853 char *tag = XmFONTLIST_DEFAULT_TAG;
854 unsigned char alignment;
855 + const char *star = (win->fileChanged && !win->transient) ? "*" : "";
857 /* Set tab label to document's filename. Position of
858 "*" (modified) will change per label alignment setting */
859 XtVaGetValues(win->tab, XmNalignment, &alignment, NULL);
860 if (alignment != XmALIGNMENT_END) {
861 sprintf(labelString, "%s%s",
862 - win->fileChanged? "*" : "",
866 sprintf(labelString, "%s%s",
868 - win->fileChanged? "*" : "");
872 /* Make the top document stand out a little more */
873 if (IsTopDocument(win))
875 @@ -3879,10 +3885,11 @@ void RefreshMenuToggleStates(WindowInfo
877 XmToggleButtonSetState(window->autoSaveItem, window->autoSave, False);
878 XmToggleButtonSetState(window->overtypeModeItem, window->overstrike, False);
879 XmToggleButtonSetState(window->matchSyntaxBasedItem, window->matchSyntaxBased, False);
880 XmToggleButtonSetState(window->readOnlyItem, IS_USER_LOCKED(window->lockReasons), False);
881 + XmToggleButtonSetState(window->transientItem, window->transient, False);
883 XtSetSensitive(window->smartIndentItem,
884 SmartIndentMacrosAvailable(LanguageModeName(window->languageMode)));
886 SetAutoIndent(window, window->indentStyle);
887 @@ -4447,10 +4454,11 @@ static void cloneDocument(WindowInfo *wi
888 window->fileFormat = orgWin->fileFormat;
889 window->lastModTime = orgWin->lastModTime;
890 window->fileChanged = orgWin->fileChanged;
891 window->fileMissing = orgWin->fileMissing;
892 window->lockReasons = orgWin->lockReasons;
893 + window->transient = orgWin->transient;
894 window->autoSaveCharCount = orgWin->autoSaveCharCount;
895 window->autoSaveOpCount = orgWin->autoSaveOpCount;
896 window->undoOpCount = orgWin->undoOpCount;
897 window->undoMemUsed = orgWin->undoMemUsed;
898 window->lockReasons = orgWin->lockReasons;
899 diff --quilt old/source/nedit.c new/source/nedit.c
900 --- old/source/nedit.c
901 +++ new/source/nedit.c
902 @@ -565,11 +565,11 @@ int main(int argc, char **argv)
904 if (strcmp(GetPrefServerName(), "") != 0) {
908 - EditNewFile(NULL, geometry, iconic, langMode, NULL);
909 + EditNewFile(NULL, geometry, iconic, langMode, NULL, False);
910 ReadMacroInitFile(WindowList);
913 /* Process any command line arguments (-tags, -do, -read, -create,
914 +<line_number>, -line, -server, and files to edit) not already
915 diff --quilt old/source/server.c new/source/server.c
916 --- old/source/server.c
917 +++ new/source/server.c
918 @@ -354,11 +354,11 @@ static void processServerCommandString(c
919 if (!window->filenameSet && !window->fileChanged &&
920 isLocatedOnDesktop(window, currentDesktop))
922 if (window == NULL) {
923 EditNewFile(findWindowOnDesktop(tabbed, currentDesktop), NULL,
924 - False, NULL, NULL);
925 + False, NULL, NULL, False);
929 RaiseDocument(window);
930 XMapRaised(TheDisplay, XtWindow(window->shell));
931 @@ -418,11 +418,12 @@ static void processServerCommandString(c
934 if (*doCommand == '\0') {
935 if (window == NULL) {
936 EditNewFile(findWindowOnDesktop(tabbed, currentDesktop),
937 - NULL, iconicFlag, lmLen==0?NULL:langMode, NULL);
938 + NULL, iconicFlag, lmLen==0?NULL:langMode, NULL,
942 RaiseDocument(window);
944 RaiseDocumentWindow(window);
945 diff --quilt old/source/shell.c new/source/shell.c
946 --- old/source/shell.c
947 +++ new/source/shell.c
948 @@ -387,11 +387,12 @@ void DoShellMenuCmd(WindowInfo *window,
949 if (output == TO_DIALOG) {
951 flags |= OUTPUT_TO_DIALOG;
953 } else if (output == TO_NEW_WINDOW) {
954 - EditNewFile(GetPrefOpenInTab()?inWindow:NULL, NULL, False, NULL, window->path);
955 + EditNewFile(GetPrefOpenInTab()?inWindow:NULL, NULL, False, NULL,
956 + window->path, False);
957 outWidget = WindowList->textArea;
958 inWindow = WindowList;
961 } else { /* TO_SAME_WINDOW */