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,19 +108,19 @@ 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];
114 /*... test for creatability? */
116 /* Find a (relatively) unique name for the new file */
117 - UniqueUntitledName(name);
118 + UniqueUntitledName(name, transient);
120 /* create new window/document */
122 window = CreateDocument(inWindow, name);
124 @@ -145,10 +145,18 @@ WindowInfo *EditNewFile(WindowInfo *inWi
125 if (iconic && IsIconic(window))
126 RaiseDocument(window);
128 RaiseDocumentWindow(window);
131 + /* Set the window to transient mode. */
132 + String apParams[1];
135 + XtCallActionProc(window->lastFocus, "set_transient", NULL, apParams, 1);
143 @@ -708,21 +716,26 @@ int CloseFileAndWindow(WindowInfo *windo
145 /* Make sure that the window is not in iconified state */
146 if (window->fileChanged)
147 RaiseDocumentWindow(window);
149 - /* If the window is a normal & unmodified file or an empty new file,
150 - or if the user wants to ignore external modifications then
151 - just close it. Otherwise ask for confirmation first. */
152 - if (!window->fileChanged &&
153 + /* If the document is transient, belongs to a normal & unmodified file
154 + or is empty and unchanged, or if the user wants to ignore external
155 + modifications then just close it. Otherwise ask for confirmation
159 + window->transient ||
160 + (!window->fileChanged &&
162 ((!window->fileMissing && window->lastModTime > 0) ||
164 (window->fileMissing && window->lastModTime == 0) ||
165 /* File deleted/modified externally, ignored by user. */
166 - !GetPrefWarnFileMods()))
167 + !GetPrefWarnFileMods())))
169 + RemoveBackupFile(window);
171 /* up-to-date windows don't have outstanding backup files to close */
174 if (preResponse == PROMPT_SBC_DIALOG_RESPONSE)
175 @@ -1060,10 +1073,20 @@ static int doSave(WindowInfo *window)
176 window->fileMissing = TRUE;
181 + /* If the window was previously transient and the user saves it, than he
182 + obviously don't want the window to be transient anymore */
183 + if (window->transient) {
184 + /* Unset the window to transient mode. */
185 + String apParams[1];
188 + XtCallActionProc(window->lastFocus, "set_transient", NULL, apParams, 1);
191 /* call "post_save_hook" */
192 MacroApplyHook(window, "post_save_hook", 0, NULL, NULL);
196 @@ -1158,14 +1181,10 @@ int WriteBackupFile(WindowInfo *window)
198 void RemoveBackupFile(WindowInfo *window)
200 char name[MAXPATHLEN];
202 - /* Don't delete backup files when backups aren't activated. */
203 - if (window->autoSave == FALSE)
206 backupFileName(window, name, sizeof(name));
211 @@ -1590,28 +1609,35 @@ int PromptForNewFile(WindowInfo *window,
215 ** Find a name for an untitled file, unique in the name space of in the opened
216 ** files in this session, i.e. Untitled or Untitled_nn, and write it into
217 -** the string "name".
218 +** the string "name" (at least MAXPATHLEN).
220 -void UniqueUntitledName(char *name)
221 +void UniqueUntitledName(char *name, Boolean transient)
225 + const char *base = transient ? "Transient" : "Untitled";
227 + size_t baseLen = strlen(base);
228 + size_t totalSpace = MAXPATHLEN;
230 + snprintf(name, MAXPATHLEN, "%s", base);
231 + tail = name + baseLen;
232 + totalSpace -= baseLen;
236 + for (w = WindowList; w != NULL; w = w->next)
237 + if (!strcmp(w->filename, name))
242 - for (i=0; i<INT_MAX; i++) {
244 - sprintf(name, "Untitled");
246 - sprintf(name, "Untitled_%d", i);
247 - for (w=WindowList; w!=NULL; w=w->next)
248 - if (!strcmp(w->filename, name))
253 + snprintf(tail, totalSpace, "_%d", ++i);
254 + } while (i < INT_MAX);
258 ** Callback that guards us from trying to access a window after it has
259 ** been destroyed while a modal dialog is up.
260 diff --quilt old/source/highlightData.c new/source/highlightData.c
261 --- old/source/highlightData.c
262 +++ new/source/highlightData.c
263 @@ -546,14 +546,14 @@ static char *DefaultPatternSets[] = {
264 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
265 Logical operators:\"~|&|\\|\":::Text Arg2::}",
267 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
268 Comment:\"#\":\"$\"::Comment::\n\
269 - 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\
270 + 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\
271 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\
272 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\
273 - 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\
274 + 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\
275 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\
276 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\
277 Macro Hooks:\"<(?:(?:pre|post)_(?:open|save)|cursor_moved|modified|(?:losing_)?focus)_hook(?=\\s*\\()\":::Subroutine1::\n\
278 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
279 Braces:\"[{}\\[\\]]\":::Keyword::\n\
280 diff --quilt old/source/windowTitle.c new/source/windowTitle.c
281 --- old/source/windowTitle.c
282 +++ new/source/windowTitle.c
283 @@ -99,10 +99,11 @@ static struct {
288 Widget oFileChangedW;
289 + Widget oTransientW;
291 Widget oFileReadOnlyW;
292 Widget oServerEqualViewW;
294 char filename[MAXPATHLEN];
295 @@ -111,15 +112,16 @@ static struct {
296 char serverName[MAXPATHLEN];
303 int suppressFormatUpdate;
304 } etDialog = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
305 - NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
306 - NULL,NULL,"","","","",0,0,0,0,0};
307 + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
308 + NULL,NULL,"","","","",0,0,0,0,0,0};
312 static char* removeSequence(char* sourcePtr, char c)
314 @@ -257,10 +259,11 @@ char *FormatWindowTitle(const char* file
315 const char* serverName,
321 const char* titleFormat)
323 static char title[WINDOWTITLE_MAX_LEN];
324 char *titlePtr = title;
325 char* titleEnd = title + WINDOWTITLE_MAX_LEN - 1;
326 @@ -359,18 +362,20 @@ char *FormatWindowTitle(const char* file
327 titlePtr = safeStrCpy(titlePtr, titleEnd, GetNameOfHost());
330 case 'S': /* file status */
331 fileStatusPresent = True;
332 - if (IS_ANY_LOCKED_IGNORING_USER(lockReasons) && fileChanged)
333 + if (IS_ANY_LOCKED_IGNORING_USER(lockReasons) && fileChanged && !transient)
334 titlePtr = safeStrCpy(titlePtr, titleEnd, "read only, modified");
335 else if (IS_ANY_LOCKED_IGNORING_USER(lockReasons))
336 titlePtr = safeStrCpy(titlePtr, titleEnd, "read only");
337 - else if (IS_USER_LOCKED(lockReasons) && fileChanged)
338 + else if (IS_USER_LOCKED(lockReasons) && fileChanged && !transient)
339 titlePtr = safeStrCpy(titlePtr, titleEnd, "locked, modified");
340 else if (IS_USER_LOCKED(lockReasons))
341 titlePtr = safeStrCpy(titlePtr, titleEnd, "locked");
342 + else if (transient)
343 + titlePtr = safeStrCpy(titlePtr, titleEnd, "transient");
344 else if (fileChanged)
345 titlePtr = safeStrCpy(titlePtr, titleEnd, "modified");
348 case 'u': /* user name */
349 @@ -386,18 +391,20 @@ char *FormatWindowTitle(const char* file
350 fileStatusPresent = True;
351 if (*titleFormat && *titleFormat == 'S')
355 - if (IS_ANY_LOCKED_IGNORING_USER(lockReasons) && fileChanged)
356 + if (IS_ANY_LOCKED_IGNORING_USER(lockReasons) && fileChanged && !transient)
357 titlePtr = safeStrCpy(titlePtr, titleEnd, "RO*");
358 else if (IS_ANY_LOCKED_IGNORING_USER(lockReasons))
359 titlePtr = safeStrCpy(titlePtr, titleEnd, "RO");
360 - else if (IS_USER_LOCKED(lockReasons) && fileChanged)
361 + else if (IS_USER_LOCKED(lockReasons) && fileChanged && !transient)
362 titlePtr = safeStrCpy(titlePtr, titleEnd, "LO*");
363 else if (IS_USER_LOCKED(lockReasons))
364 titlePtr = safeStrCpy(titlePtr, titleEnd, "LO");
365 + else if (transient)
366 + titlePtr = safeStrCpy(titlePtr, titleEnd, "TR");
367 else if (fileChanged)
368 titlePtr = safeStrCpy(titlePtr, titleEnd, "*");
372 @@ -462,10 +469,11 @@ char *FormatWindowTitle(const char* file
376 /* Enable/disable test buttons, depending on presence of codes */
377 XtSetSensitive(etDialog.oFileChangedW, fileStatusPresent);
378 + XtSetSensitive(etDialog.oTransientW, fileStatusPresent);
379 XtSetSensitive(etDialog.oFileReadOnlyW, fileStatusPresent);
380 XtSetSensitive(etDialog.oFileLockedW, fileStatusPresent &&
381 !IS_PERM_LOCKED(etDialog.lockReasons));
383 XtSetSensitive(etDialog.oServerNameW, serverNamePresent);
384 @@ -491,10 +499,12 @@ static void setToggleButtons(void)
386 XmToggleButtonSetState(etDialog.oDirW,
387 etDialog.filenameSet == True, False);
388 XmToggleButtonSetState(etDialog.oFileChangedW,
389 etDialog.fileChanged == True, False);
390 + XmToggleButtonSetState(etDialog.oTransientW,
391 + etDialog.transient == True, False);
392 XmToggleButtonSetState(etDialog.oFileReadOnlyW,
393 IS_PERM_LOCKED(etDialog.lockReasons), False);
394 XmToggleButtonSetState(etDialog.oFileLockedW,
395 IS_USER_LOCKED(etDialog.lockReasons), False);
396 /* Read-only takes precedence on locked */
397 @@ -557,10 +567,11 @@ static void formatChangedCB(Widget w, Xt
401 etDialog.lockReasons,
402 XmToggleButtonGetState(etDialog.oFileChangedW),
403 + XmToggleButtonGetState(etDialog.oTransientW),
406 XmTextFieldSetString(etDialog.previewW, title);
409 @@ -587,10 +598,16 @@ static void fileChangedCB(Widget w, XtPo
411 etDialog.fileChanged = XmToggleButtonGetState(w);
412 formatChangedCB(w, clientData, callData);
415 +static void transientCB(Widget w, XtPointer clientData, XtPointer callData)
417 + etDialog.transient = XmToggleButtonGetState(w);
418 + formatChangedCB(w, clientData, callData);
421 static void fileLockedCB(Widget w, XtPointer clientData, XtPointer callData)
423 SET_USER_LOCKED(etDialog.lockReasons, XmToggleButtonGetState(w));
424 formatChangedCB(w, clientData, callData);
426 @@ -1274,39 +1291,50 @@ static void createEditTitleDialog(Widget
427 XmNtopWidget, testLbl,
428 XmNlabelString, s1=XmStringCreateSimple("File modified"),
429 XmNmnemonic, 'o', NULL);
430 XtAddCallback(etDialog.oFileChangedW, XmNvalueChangedCallback, fileChangedCB, NULL);
433 - etDialog.oFileReadOnlyW = XtVaCreateManagedWidget("fileReadOnly",
434 - xmToggleButtonWidgetClass, previewBox,
436 + etDialog.oTransientW = XtVaCreateManagedWidget("transient",
437 + xmToggleButtonWidgetClass, previewBox,
438 XmNleftAttachment, XmATTACH_WIDGET,
439 XmNleftWidget, etDialog.oFileChangedW,
440 XmNtopAttachment, XmATTACH_WIDGET,
441 XmNtopWidget, testLbl,
442 + XmNlabelString, s1=XmStringCreateSimple("File transient"),
443 + XmNmnemonic, 't', NULL);
444 + XtAddCallback(etDialog.oTransientW, XmNvalueChangedCallback, transientCB, NULL);
447 + etDialog.oFileReadOnlyW = XtVaCreateManagedWidget("fileReadOnly",
448 + xmToggleButtonWidgetClass, previewBox,
449 + XmNleftAttachment, XmATTACH_POSITION,
450 + XmNleftPosition, RADIO_INDENT,
451 + XmNtopAttachment, XmATTACH_WIDGET,
452 + XmNtopWidget, etDialog.oFileChangedW,
453 XmNlabelString, s1=XmStringCreateSimple("File read only"),
454 XmNmnemonic, 'n', NULL);
455 XtAddCallback(etDialog.oFileReadOnlyW, XmNvalueChangedCallback, fileReadOnlyCB, NULL);
458 etDialog.oFileLockedW = XtVaCreateManagedWidget("fileLocked",
459 xmToggleButtonWidgetClass, previewBox,
460 XmNleftAttachment, XmATTACH_WIDGET,
461 XmNleftWidget, etDialog.oFileReadOnlyW,
462 XmNtopAttachment, XmATTACH_WIDGET,
463 - XmNtopWidget, testLbl,
464 + XmNtopWidget, etDialog.oFileChangedW,
465 XmNlabelString, s1=XmStringCreateSimple("File locked"),
466 XmNmnemonic, 'l', NULL);
467 XtAddCallback(etDialog.oFileLockedW, XmNvalueChangedCallback, fileLockedCB, NULL);
470 etDialog.oServerNameW = XtVaCreateManagedWidget("servernameSet",
471 xmToggleButtonWidgetClass, previewBox,
472 XmNleftAttachment, XmATTACH_POSITION,
473 XmNleftPosition, RADIO_INDENT,
474 XmNtopAttachment, XmATTACH_WIDGET,
475 - XmNtopWidget, etDialog.oFileChangedW,
476 + XmNtopWidget, etDialog.oFileReadOnlyW,
477 XmNlabelString, s1=XmStringCreateSimple("Server name present"),
478 XmNmnemonic, 'v', NULL);
479 XtAddCallback(etDialog.oServerNameW, XmNvalueChangedCallback, serverNameCB, NULL);
482 @@ -1455,10 +1483,11 @@ void EditCustomTitleFormat(WindowInfo *w
484 etDialog.isServer = IsServer;
485 etDialog.filenameSet = window->filenameSet;
486 etDialog.lockReasons = window->lockReasons;
487 etDialog.fileChanged = window->fileChanged;
488 + etDialog.transient = window->transient;
490 if (etDialog.window != window && etDialog.form)
492 /* Destroy the dialog owned by the other window.
493 Note: don't rely on the destroy event handler to reset the
494 diff --quilt old/source/windowTitle.h new/source/windowTitle.h
495 --- old/source/windowTitle.h
496 +++ new/source/windowTitle.h
497 @@ -40,10 +40,11 @@ char *FormatWindowTitle(const char* file
498 const char* serverName,
504 const char* titleFormat);
506 void EditCustomTitleFormat(WindowInfo *window);
508 #endif /* NEDIT_WINDOWTITLE_H_INCLUDED */
509 diff --quilt old/source/macro.c new/source/macro.c
510 --- old/source/macro.c
511 +++ new/source/macro.c
512 @@ -365,10 +365,12 @@ static int rangesetListMV(WindowInfo *wi
513 int nArgs, DataValue *result, char **errMsg);
514 static int versionMV(WindowInfo* window, DataValue* argList, int nArgs,
515 DataValue* result, char** errMsg);
516 static int neditHomeMV(WindowInfo *window, DataValue *argList, int nArgs,
517 DataValue *result, char **errMsg);
518 +static int transientMV(WindowInfo *window, DataValue *argList, int nArgs,
519 + DataValue *result, char **errMsg);
520 static int rangesetCreateMS(WindowInfo *window, DataValue *argList, int nArgs,
521 DataValue *result, char **errMsg);
522 static int rangesetDestroyMS(WindowInfo *window, DataValue *argList, int nArgs,
523 DataValue *result, char **errMsg);
524 static int rangesetGetByNameMS(WindowInfo *window, DataValue *argList, int nArgs,
525 @@ -525,10 +527,11 @@ static const BuiltInSubrName SpecialVars
526 { "$backlight_string", backlightStringMV },
528 { "$rangeset_list", rangesetListMV },
529 { "$VERSION", versionMV },
530 { "$NEDIT_HOME", neditHomeMV },
531 + { "$transient", transientMV },
532 { NULL, NULL } /* sentinel */
535 /* Global symbols for "returning" secondary values from built-in functions */
536 static int STRING_DIALOG_BUTTON, SEARCH_END, READ_STATUS,
537 @@ -4838,10 +4841,21 @@ static int neditHomeMV(WindowInfo *windo
543 +** Returns the transient status of the current window
545 +static int transientMV(WindowInfo *window, DataValue *argList, int nArgs,
546 + DataValue *result, char **errMsg)
548 + result->tag = INT_TAG;
549 + result->val.n = !!window->transient;
554 ** Built-in macro subroutine to create a new rangeset or rangesets.
555 ** If called with one argument: $1 is the number of rangesets required and
556 ** return value is an array indexed 0 to n, with the rangeset labels as values;
557 ** (or an empty array if the requested number of rangesets are not available).
558 ** If called with no arguments, returns a single rangeset label (not an array),
559 diff --quilt old/source/menu.c new/source/menu.c
560 --- old/source/menu.c
561 +++ new/source/menu.c
562 @@ -413,10 +413,12 @@ static void setMatchSyntaxBasedAP(Widget
564 static void setOvertypeModeAP(Widget w, XEvent *event, String *args,
566 static void setLockedAP(Widget w, XEvent *event, String *args,
568 +static void setTransientAP(Widget text, XEvent *event, String *args,
570 static void setUseTabsAP(Widget w, XEvent *event, String *args,
572 static void setEmTabDistAP(Widget w, XEvent *event, String *args,
574 static void setTabDistAP(Widget w, XEvent *event, String *args,
575 @@ -583,10 +585,11 @@ static XtActionsRec Actions[] = {
576 {"set_incremental_backup", setIncrementalBackupAP},
577 {"set_show_matching", setShowMatchingAP},
578 {"set_match_syntax_based", setMatchSyntaxBasedAP},
579 {"set_overtype_mode", setOvertypeModeAP},
580 {"set_locked", setLockedAP},
581 + {"set_transient", setTransientAP},
582 {"set_tab_dist", setTabDistAP},
583 {"set_em_tab_dist", setEmTabDistAP},
584 {"set_use_tabs", setUseTabsAP},
585 {"set_fonts", setFontsAP},
586 {"set_language_mode", setLanguageModeAP}
587 @@ -768,10 +771,12 @@ Widget CreateMenuBar(Widget parent, Wind
588 createMenuSeparator(menuPane, "sep4", SHORT);
589 window->overtypeModeItem = createMenuToggle(menuPane, "overtype", "Overtype", 'O',
590 doActionCB, "set_overtype_mode", False, SHORT);
591 window->readOnlyItem = createMenuToggle(menuPane, "readOnly", "Read Only",
592 'y', doActionCB, "set_locked", IS_USER_LOCKED(window->lockReasons), FULL);
593 + window->transientItem = createMenuToggle(menuPane, "transient", "Transient",
594 + 'r', doActionCB, "set_transient", window->transient, FULL);
598 ** "Search" pull down menu.
600 @@ -1158,10 +1163,12 @@ Widget CreateMenuBar(Widget parent, Wind
601 createMenuSeparator(menuPane, "sep2", SHORT);
602 window->overtypeModeItem = createMenuToggle(menuPane, "overtype", "Overtype", 'O',
603 doActionCB, "set_overtype_mode", False, SHORT);
604 window->readOnlyItem = createMenuToggle(menuPane, "readOnly", "Read Only",
605 'y', doActionCB, "set_locked", IS_USER_LOCKED(window->lockReasons), FULL);
606 + window->transientItem = createMenuToggle(menuPane, "transient", "Transient",
607 + 'r', doActionCB, "set_transient", window->transient, FULL);
612 ** Create the Shell menu
613 @@ -2780,10 +2787,11 @@ static void unloadTipsFileMenuCB(Widget
615 static void newAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
617 WindowInfo *window = WidgetToWindow(w);
618 int openInTab = GetPrefOpenInTab();
619 + Boolean transient = False;
622 if (strcmp(args[0], "prefs") == 0) {
623 /* accept default */;
625 @@ -2794,16 +2802,25 @@ static void newAP(Widget w, XEvent *even
628 else if (strcmp(args[0], "opposite") == 0) {
629 openInTab = !openInTab;
631 + else if (strcmp(args[0], "transient") == 0) {
635 fprintf(stderr, "nedit: Unknown argument to action procedure \"new\": %s\n", args[0]);
639 - EditNewFile(openInTab? window : NULL, NULL, False, NULL, window->path);
640 + /* Catch transient if it comes after a window type argument. */
641 + if (2 == *nArgs && strcmp(args[1], "transient") == 0) {
645 + EditNewFile(openInTab? window : NULL, NULL, False, NULL, window->path,
651 ** These are just here because our techniques make it hard to bind a menu item
652 @@ -2813,18 +2830,18 @@ static void newAP(Widget w, XEvent *even
653 static void newOppositeAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
655 WindowInfo *window = WidgetToWindow(w);
657 EditNewFile(GetPrefOpenInTab()? NULL : window, NULL, False, NULL,
659 + window->path, False);
662 static void newTabAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
664 WindowInfo *window = WidgetToWindow(w);
666 - EditNewFile(window, NULL, False, NULL, window->path);
667 + EditNewFile(window, NULL, False, NULL, window->path, False);
671 static void openDialogAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
673 @@ -2956,11 +2973,11 @@ static void revertDialogAP(Widget w, XEv
675 WindowInfo *window = WidgetToWindow(w);
678 /* re-reading file is irreversible, prompt the user first */
679 - if (window->fileChanged)
680 + if (window->fileChanged && !window->transient)
682 b = DialogF(DF_QUES, window->shell, 2, "Discard Changes",
683 "Discard changes to\n%s%s?", "OK", "Cancel", window->path,
686 @@ -3184,11 +3201,12 @@ static void exitAP(Widget w, XEvent *eve
687 user really wants to exit */
690 strcpy(ptr, "Editing: "); ptr += 9; lineLen += 9;
691 for (win=WindowList; win!=NULL; win=win->next) {
692 - sprintf(filename, "%s%s", win->filename, win->fileChanged? "*": "");
693 + sprintf(filename, "%s%s", win->filename,
694 + (win->fileChanged && !win->transient) ? "*": "");
696 titleLen = strlen(title);
697 if (ptr - exitMsg + titleLen + 30 >= DF_MAX_MSG_LENGTH) {
698 strcpy(ptr, "..."); ptr += 3;
700 @@ -4312,10 +4330,31 @@ static void setLockedAP(Widget w, XEvent
701 XmToggleButtonSetState(window->readOnlyItem, IS_ANY_LOCKED(window->lockReasons), False);
702 UpdateWindowTitle(window);
703 UpdateWindowReadOnly(window);
707 +** Action procedure for setting or toggling the transient flag.
709 +static void setTransientAP(Widget text, XEvent *event, String *args,
712 + WindowInfo *window = WidgetToWindow(text);
715 + ACTION_BOOL_PARAM_OR_TOGGLE(newState, *nArgs, args,
716 + window->transient, "set_transient");
718 + window->transient = newState;
719 + if (IsTopDocument(window)) {
720 + XmToggleButtonSetState(window->transientItem, window->transient, False);
723 + UpdateWindowTitle(window);
724 + RefreshTabState(window);
727 static void setTabDistAP(Widget w, XEvent *event, String *args,
730 WindowInfo *window = WidgetToWindow(w);
732 @@ -4697,11 +4736,11 @@ void AddToPrevOpenMenu(const char *filen
733 static char* getWindowsMenuEntry(const WindowInfo* window)
735 static char fullTitle[MAXPATHLEN * 2 + 3+ 1];
737 sprintf(fullTitle, "%s%s", window->filename,
738 - window->fileChanged? "*" : "");
739 + (window->fileChanged && !window->transient) ? "*" : "");
741 if (GetPrefShowPathInWindowsMenu() && window->filenameSet)
743 strcat(fullTitle, " - ");
744 strcat(fullTitle, window->path);
745 diff --quilt old/source/nedit.h new/source/nedit.h
746 --- old/source/nedit.h
747 +++ new/source/nedit.h
748 @@ -330,10 +330,11 @@ typedef struct _WindowInfo {
749 Widget replaceMultiFileList;
750 Widget replaceMultiFilePathBtn;
751 Widget fontDialog; /* NULL, unless font dialog is up */
752 Widget colorDialog; /* NULL, unless color dialog is up */
753 Widget readOnlyItem; /* menu bar settable widgets... */
754 + Widget transientItem;
758 Widget newOppositeItem;
760 @@ -497,10 +498,11 @@ typedef struct _WindowInfo {
761 of selection related menu items */
762 Boolean filenameSet; /* is the window still "Untitled"? */
763 Boolean fileChanged; /* has window been modified? */
764 Boolean fileMissing; /* is the window's file gone? */
765 int lockReasons; /* all ways a file can be locked */
766 + Boolean transient; /* buffer is transient */
767 Boolean autoSave; /* is autosave turned on? */
768 Boolean saveOldVersion; /* keep old version in filename.bck */
769 char indentStyle; /* whether/how to auto indent */
770 char wrapMode; /* line wrap style: NO_WRAP,
771 NEWLINE_WRAP or CONTINUOUS_WRAP */
772 diff --quilt old/source/window.c new/source/window.c
773 --- old/source/window.c
774 +++ new/source/window.c
775 @@ -267,10 +267,11 @@ WindowInfo *CreateWindow(const char *nam
776 window->autoSaveCharCount = 0;
777 window->autoSaveOpCount = 0;
778 window->undoOpCount = 0;
779 window->undoMemUsed = 0;
780 CLEAR_ALL_LOCKS(window->lockReasons);
781 + window->transient = False;
782 window->indentStyle = GetPrefAutoIndent(PLAIN_LANGUAGE_MODE);
783 window->autoSave = GetPrefAutoSave();
784 window->saveOldVersion = GetPrefSaveOldVersion();
785 window->wrapMode = GetPrefWrap(PLAIN_LANGUAGE_MODE);
786 window->showWrapMargin = GetPrefShowWrapMargin();
787 @@ -995,12 +996,13 @@ void CloseWindow(WindowInfo *window)
789 /* if this is the last window, or must be kept alive temporarily because
790 it's running the macro calling us, don't close it, make it Untitled */
791 if (keepWindow || (WindowList == window && window->next == NULL)) {
792 window->filename[0] = '\0';
793 - UniqueUntitledName(name);
794 + UniqueUntitledName(name, False);
795 CLEAR_ALL_LOCKS(window->lockReasons);
796 + window->transient = False;
797 window->fileMode = 0;
800 strcpy(window->filename, name);
801 strcpy(window->path, "");
802 @@ -2109,16 +2111,17 @@ void UpdateWindowTitle(const WindowInfo
809 GetPrefTitleFormat());
811 iconTitle = XtMalloc(strlen(window->filename) + 2); /* strlen("*")+1 */
813 strcpy(iconTitle, window->filename);
814 - if (window->fileChanged)
815 + if (window->fileChanged && !window->transient)
816 strcat(iconTitle, "*");
817 XtVaSetValues(window->shell, XmNtitle, title, XmNiconName, iconTitle, NULL);
819 /* If there's a find or replace dialog up in "Keep Up" mode, with a
820 file name in the title, update it too */
821 @@ -2443,11 +2446,12 @@ static void modifiedCB(int pos, int nIns
822 SaveUndoInformation(window, pos, nInserted, nDeleted, deletedText);
824 /* Trigger automatic backup if operation or character limits reached */
825 if (window->autoSave &&
826 (window->autoSaveCharCount > AUTOSAVE_CHAR_LIMIT ||
827 - window->autoSaveOpCount > AUTOSAVE_OP_LIMIT)) {
828 + window->autoSaveOpCount > AUTOSAVE_OP_LIMIT)
829 + && !window->transient) {
830 WriteBackupFile(window);
831 window->autoSaveCharCount = 0;
832 window->autoSaveOpCount = 0;
835 @@ -3439,10 +3443,11 @@ WindowInfo* CreateDocument(WindowInfo* s
836 window->autoSaveCharCount = 0;
837 window->autoSaveOpCount = 0;
838 window->undoOpCount = 0;
839 window->undoMemUsed = 0;
840 CLEAR_ALL_LOCKS(window->lockReasons);
841 + window->transient = False;
842 window->indentStyle = GetPrefAutoIndent(PLAIN_LANGUAGE_MODE);
843 window->autoSave = GetPrefAutoSave();
844 window->saveOldVersion = GetPrefSaveOldVersion();
845 window->wrapMode = GetPrefWrap(PLAIN_LANGUAGE_MODE);
846 window->showWrapMargin = GetPrefShowWrapMargin();
847 @@ -3728,22 +3733,23 @@ void RefreshTabState(WindowInfo *win)
849 XmString s1, tipString;
850 char labelString[MAXPATHLEN];
851 char *tag = XmFONTLIST_DEFAULT_TAG;
852 unsigned char alignment;
853 + const char *star = (win->fileChanged && !win->transient) ? "*" : "";
855 /* Set tab label to document's filename. Position of
856 "*" (modified) will change per label alignment setting */
857 XtVaGetValues(win->tab, XmNalignment, &alignment, NULL);
858 if (alignment != XmALIGNMENT_END) {
859 sprintf(labelString, "%s%s",
860 - win->fileChanged? "*" : "",
864 sprintf(labelString, "%s%s",
866 - win->fileChanged? "*" : "");
870 /* Make the top document stand out a little more */
871 if (IsTopDocument(win))
873 @@ -3879,10 +3885,11 @@ void RefreshMenuToggleStates(WindowInfo
875 XmToggleButtonSetState(window->autoSaveItem, window->autoSave, False);
876 XmToggleButtonSetState(window->overtypeModeItem, window->overstrike, False);
877 XmToggleButtonSetState(window->matchSyntaxBasedItem, window->matchSyntaxBased, False);
878 XmToggleButtonSetState(window->readOnlyItem, IS_USER_LOCKED(window->lockReasons), False);
879 + XmToggleButtonSetState(window->transientItem, window->transient, False);
881 XtSetSensitive(window->smartIndentItem,
882 SmartIndentMacrosAvailable(LanguageModeName(window->languageMode)));
884 SetAutoIndent(window, window->indentStyle);
885 @@ -4447,10 +4454,11 @@ static void cloneDocument(WindowInfo *wi
886 window->fileFormat = orgWin->fileFormat;
887 window->lastModTime = orgWin->lastModTime;
888 window->fileChanged = orgWin->fileChanged;
889 window->fileMissing = orgWin->fileMissing;
890 window->lockReasons = orgWin->lockReasons;
891 + window->transient = orgWin->transient;
892 window->autoSaveCharCount = orgWin->autoSaveCharCount;
893 window->autoSaveOpCount = orgWin->autoSaveOpCount;
894 window->undoOpCount = orgWin->undoOpCount;
895 window->undoMemUsed = orgWin->undoMemUsed;
896 window->lockReasons = orgWin->lockReasons;
897 diff --quilt old/source/nedit.c new/source/nedit.c
898 --- old/source/nedit.c
899 +++ new/source/nedit.c
900 @@ -565,11 +565,11 @@ int main(int argc, char **argv)
902 if (strcmp(GetPrefServerName(), "") != 0) {
906 - EditNewFile(NULL, geometry, iconic, langMode, NULL);
907 + EditNewFile(NULL, geometry, iconic, langMode, NULL, False);
908 ReadMacroInitFile(WindowList);
911 /* Process any command line arguments (-tags, -do, -read, -create,
912 +<line_number>, -line, -server, and files to edit) not already
913 diff --quilt old/source/server.c new/source/server.c
914 --- old/source/server.c
915 +++ new/source/server.c
916 @@ -354,11 +354,11 @@ static void processServerCommandString(c
917 if (!window->filenameSet && !window->fileChanged &&
918 isLocatedOnDesktop(window, currentDesktop))
920 if (window == NULL) {
921 EditNewFile(findWindowOnDesktop(tabbed, currentDesktop), NULL,
922 - False, NULL, NULL);
923 + False, NULL, NULL, False);
927 RaiseDocument(window);
928 XMapRaised(TheDisplay, XtWindow(window->shell));
929 @@ -418,11 +418,12 @@ static void processServerCommandString(c
932 if (*doCommand == '\0') {
933 if (window == NULL) {
934 EditNewFile(findWindowOnDesktop(tabbed, currentDesktop),
935 - NULL, iconicFlag, lmLen==0?NULL:langMode, NULL);
936 + NULL, iconicFlag, lmLen==0?NULL:langMode, NULL,
940 RaiseDocument(window);
942 RaiseDocumentWindow(window);
943 diff --quilt old/source/shell.c new/source/shell.c
944 --- old/source/shell.c
945 +++ new/source/shell.c
946 @@ -387,11 +387,12 @@ void DoShellMenuCmd(WindowInfo *window,
947 if (output == TO_DIALOG) {
949 flags |= OUTPUT_TO_DIALOG;
951 } else if (output == TO_NEW_WINDOW) {
952 - EditNewFile(GetPrefOpenInTab()?inWindow:NULL, NULL, False, NULL, window->path);
953 + EditNewFile(GetPrefOpenInTab()?inWindow:NULL, NULL, False, NULL,
954 + window->path, False);
955 outWidget = WindowList->textArea;
956 inWindow = WindowList;
959 } else { /* TO_SAME_WINDOW */