update .gitignore
[nedit-bw.git] / language_mode_hook.patch
blob5f0ddab76a77a2db10370cb5f054900125f31f04
1 ---
3 doc/help.etx | 3 +++
4 source/Makefile.dependencies | 1 +
5 source/highlightData.c | 2 +-
6 source/preferences.c | 15 +++++++++++++++
7 4 files changed, 20 insertions(+), 1 deletion(-)
9 diff --quilt old/source/preferences.c new/source/preferences.c
10 --- old/source/preferences.c
11 +++ new/source/preferences.c
12 @@ -45,10 +45,11 @@ static const char CVSID[] = "$Id: prefer
13 #include "regularExp.h"
14 #include "smartIndent.h"
15 #include "windowTitle.h"
16 #include "server.h"
17 #include "tags.h"
18 +#include "macro.h"
20 /* Pattern Match Feature */
21 #include "patternMatchData.h"
23 #include "../util/prefFile.h"
24 @@ -4923,10 +4924,24 @@ static void reapplyLanguageMode(WindowIn
25 AddTagsFile( LanguageModes[mode]->defTipsFile, TIP );
28 /* Add/remove language specific menu items */
29 UpdateUserMenus(window);
31 + {
32 + char *oldModeName = LanguageModeName(oldMode);
33 + DataValue oldModeArg;
35 + if (oldModeName == NULL) {
36 + oldModeName = "Plain";
37 + }
39 + oldModeArg.tag = STRING_TAG;
40 + AllocNStringCpy(&oldModeArg.val.str, oldModeName);
42 + MacroApplyHook(window, "language_mode_hook", 1, &oldModeArg, NULL);
43 + }
47 ** Find and return the name of the appropriate languange mode for
48 ** the file in "window". Returns a pointer to a string, which will
49 diff --quilt old/doc/help.etx new/doc/help.etx
50 --- old/doc/help.etx
51 +++ new/doc/help.etx
52 @@ -3870,10 +3870,13 @@ Hooks
53 Called when a document gets the input focus.
55 **losing_focus_hook()**
56 Called before a document lost the input focus.
58 +**language_mode_hook(~previous-language-mode~)**
59 + Called after a language mode change was performed.
61 ----------------------------------------------------------------------
63 Customizing
64 ===========
66 diff --quilt old/source/Makefile.dependencies new/source/Makefile.dependencies
67 --- old/source/Makefile.dependencies
68 +++ new/source/Makefile.dependencies
69 @@ -40,10 +40,11 @@ preferences.o: preferences.c preferences
70 search.h window.h userCmds.h highlight.h highlightData.h help.h \
71 help_topic.h regularExp.h smartIndent.h windowTitle.h server.h tags.h \
72 ../util/prefFile.h ../util/misc.h ../util/DialogF.h \
73 ../util/managedList.h ../util/fontsel.h ../util/fileUtils.h \
74 ../util/utils.h ../util/clearcase.h
75 +preferences.o: macro.h
76 rangeset.o: rangeset.c textBuf.h textDisp.h rangeset.h
77 rbTree.o: rbTree.c rbTree.h
78 regexConvert.o: regexConvert.c regexConvert.h
79 regularExp.o: regularExp.c regularExp.h
80 search.o: search.c search.h nedit.h textBuf.h regularExp.h text.h \
81 diff --quilt old/source/highlightData.c new/source/highlightData.c
82 --- old/source/highlightData.c
83 +++ new/source/highlightData.c
84 @@ -555,11 +555,11 @@ static char *DefaultPatternSets[] = {
85 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\
86 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\
87 Built-in Subrs:\"<(?:append_file|beep|call|calltip|clipboard_to_string|define|dialog|filename_dialog|dict_(?:insert|complete|save|append|is_element)|escape_literal|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|get_matching|set_transient|set_window_title|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|timer_(?:add|remove)|to_(?:column|line|pos)|tolower|toupper|valid_number|write_file)(?=\\s*\\()\":::Subroutine::\n\
88 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\
89 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|select_word|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)(?=\\s*\\()\":::Subroutine::\n\
90 - Macro Hooks:\"<(?:post_open|pre_open|post_save|cursor_moved|modified|focus|losing_focus)_hook(?=\\s*\\()\":::Subroutine1::\n\
91 + Macro Hooks:\"<(?:post_open|pre_open|post_save|cursor_moved|modified|focus|losing_focus|language_mode)_hook(?=\\s*\\()\":::Subroutine1::\n\
92 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|typeof|while)>\":::Keyword::\n\
93 Braces:\"[{}\\[\\]]\":::Keyword::\n\
94 Global Variable:\"\\$[A-Za-z0-9_]+\":::Identifier1::\n\
95 String sq:\"'\":\"'\"::String::\n\
96 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\