finally break-up Patch Collection
[nedit-bw.git] / nmvarNEDIT_HOME2.diff
blob5a15a4874c17799633a1da23393063edd164086f
1 Thorsten Haude's inclusion of new NEdit Macro variables $NEDIT_HOME
2 and $VERSION.
4 Part of his "patch collection", see
6 http://sourceforge.net/tracker/index.php?func=detail&aid=1058246&group_id=11005&atid=311005
7 [ 1058246 ] Patch Collection
9 2006-11-22
11 Updaed to track CVS Head,
13 ---
15 doc/help.etx | 6 ++++++
16 source/highlightData.c | 2 +-
17 source/macro.c | 25 +++++++++++++++++++++++++
18 3 files changed, 32 insertions(+), 1 deletion(-)
20 diff --quilt old/source/macro.c new/source/macro.c
21 --- old/source/macro.c
22 +++ new/source/macro.c
23 @@ -361,10 +361,12 @@ static int backlightStringMV(WindowInfo
25 static int rangesetListMV(WindowInfo *window, DataValue *argList,
26 int nArgs, DataValue *result, char **errMsg);
27 static int versionMV(WindowInfo* window, DataValue* argList, int nArgs,
28 DataValue* result, char** errMsg);
29 +static int neditHomeMV(WindowInfo *window, DataValue *argList, int nArgs,
30 + DataValue *result, char **errMsg);
31 static int rangesetCreateMS(WindowInfo *window, DataValue *argList, int nArgs,
32 DataValue *result, char **errMsg);
33 static int rangesetDestroyMS(WindowInfo *window, DataValue *argList, int nArgs,
34 DataValue *result, char **errMsg);
35 static int rangesetGetByNameMS(WindowInfo *window, DataValue *argList, int nArgs,
36 @@ -519,10 +521,11 @@ static const BuiltInSubrName SpecialVars
37 /* DISABLED for 5.4
38 { "$backlight_string", backlightStringMV },
40 { "$rangeset_list", rangesetListMV },
41 { "$VERSION", versionMV },
42 + { "$NEDIT_HOME", neditHomeMV },
43 { NULL, NULL } /* sentinel */
46 /* Global symbols for "returning" secondary values from built-in functions */
47 static int STRING_DIALOG_BUTTON, SEARCH_END, READ_STATUS,
48 @@ -4764,10 +4767,32 @@ static int versionMV(WindowInfo* window,
49 result->val.n = version;
50 return True;
54 +** Returns the name of the directory where NEdit's run control files reside.
55 +** This is either the value of the environmental variable $NEDIT_HOME, the
56 +** default of ~/.nedit or $HOME. (See the online documentation for details
57 +** about the algorithm.)
58 +*/
59 +static int neditHomeMV(WindowInfo *window, DataValue *argList, int nArgs,
60 + DataValue *result, char **errMsg)
62 + const char *neditRCName = GetRCFileName(NEDIT_RC);
63 + char neditHome[MAXPATHLEN];
65 + if (0 != ParseFilename(neditRCName, NULL, neditHome)) {
66 + M_FAILURE("Unable to parse path of nedit.rc in %s");
67 + }
69 + result->tag = STRING_TAG;
70 + AllocNStringCpy(&result->val.str, neditHome);
72 + return True;
75 +/*
76 ** Built-in macro subroutine to create a new rangeset or rangesets.
77 ** If called with one argument: $1 is the number of rangesets required and
78 ** return value is an array indexed 0 to n, with the rangeset labels as values;
79 ** (or an empty array if the requested number of rangesets are not available).
80 ** If called with no arguments, returns a single rangeset label (not an array),
81 diff --quilt old/doc/help.etx new/doc/help.etx
82 --- old/doc/help.etx
83 +++ new/doc/help.etx
84 @@ -2536,10 +2536,16 @@ Macro Subroutines
85 yet been saved.
87 **$VERSION**
88 Returns NEdit's version number ('5006' for NEdit 5.6).
90 +**$NEDIT_HOME**
91 + Returns the name of the directory where NEdit's run control files reside.
92 + This is either the value of the environmental variable $NEDIT_HOME, the
93 + default of ~/.nedit or $HOME. (See Preferences_ for details
94 + about the algorithm.)
96 **$n_display_lines**
97 The number of lines visible in the currently active pane.
99 **$n_panes**
100 The number of panes in the current window.
101 diff --quilt old/source/highlightData.c new/source/highlightData.c
102 --- old/source/highlightData.c
103 +++ new/source/highlightData.c
104 @@ -546,11 +546,11 @@ static char *DefaultPatternSets[] = {
105 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
106 Logical operators:\"~|&|\\|\":::Text Arg2::}",
107 "NEdit Macro:2:0{\n\
108 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
109 Comment:\"#\":\"$\"::Comment::\n\
110 - 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)>\":::Identifier::\n\
111 + 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\
112 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\
113 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\
114 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|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\
115 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\
116 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\