1 From: Thorsten Haude <yoo@vranx.de>
2 Subject: New NEdit Macro variables $NEDIT_HOME
4 Part of "patch collection", see
6 http://sourceforge.net/tracker/index.php?func=detail&aid=1058246&group_id=11005&atid=311005
7 [ 1058246 ] Patch Collection
11 Updaed to track CVS Head,
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 @@ -378,6 +378,8 @@ static int rangesetListMV(WindowInfo *wi
24 int nArgs, DataValue *result, char **errMsg);
25 static int versionMV(WindowInfo* window, DataValue* argList, int nArgs,
26 DataValue* result, char** errMsg);
27 +static int neditHomeMV(WindowInfo *window, DataValue *argList, int nArgs,
28 + DataValue *result, char **errMsg);
29 static int rangesetCreateMS(WindowInfo *window, DataValue *argList, int nArgs,
30 DataValue *result, char **errMsg);
31 static int rangesetDestroyMS(WindowInfo *window, DataValue *argList, int nArgs,
32 @@ -538,6 +540,7 @@ static const BuiltInSubrName SpecialVars
34 { "$rangeset_list", rangesetListMV },
35 { "$VERSION", versionMV },
36 + { "$NEDIT_HOME", neditHomeMV },
37 { NULL, NULL } /* sentinel */
40 @@ -4762,6 +4765,28 @@ static int versionMV(WindowInfo* window,
44 +** Returns the name of the directory where NEdit's run control files reside.
45 +** This is either the value of the environmental variable $NEDIT_HOME, the
46 +** default of ~/.nedit or $HOME. (See the online documentation for details
47 +** about the algorithm.)
49 +static int neditHomeMV(WindowInfo *window, DataValue *argList, int nArgs,
50 + DataValue *result, char **errMsg)
52 + const char *neditRCName = GetRCFileName(NEDIT_RC);
53 + char neditHome[MAXPATHLEN];
55 + if (0 != ParseFilename(neditRCName, NULL, neditHome)) {
56 + M_FAILURE("Unable to parse path of nedit.rc in %s");
59 + result->tag = STRING_TAG;
60 + AllocNStringCpy(&result->val.str, neditHome);
66 ** Built-in macro subroutine to create a new rangeset or rangesets.
67 ** If called with one argument: $1 is the number of rangesets required and
68 ** return value is an array indexed 0 to n, with the rangeset labels as values;
69 diff --quilt old/doc/help.etx new/doc/help.etx
72 @@ -2538,6 +2538,12 @@ Macro Subroutines
74 Returns NEdit's version number ('5006' for NEdit 5.6).
77 + Returns the name of the directory where NEdit's run control files reside.
78 + This is either the value of the environmental variable $NEDIT_HOME, the
79 + default of ~/.nedit or $HOME. (See Preferences_ for details
80 + about the algorithm.)
83 The number of lines visible in the currently active pane.
85 diff --quilt old/source/highlightData.c new/source/highlightData.c
86 --- old/source/highlightData.c
87 +++ new/source/highlightData.c
88 @@ -548,7 +548,7 @@ static char *DefaultPatternSets[] = {
90 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
91 Comment:\"#\":\"$\"::Comment::\n\
92 - 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\
93 + 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\
94 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\
95 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\
96 Built-in Subrs:\"<(?:args|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|n_args|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\