Exemple #1
0
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
    /* make C compiler happy */
    (void) argc;
    (void) argv;

    weechat_plugin = plugin;

#ifdef USE_ENCHANT
    /* acquire enchant broker */
    broker = enchant_broker_init ();
    if (!broker)
        return WEECHAT_RC_ERROR;
#endif /* USE_ENCHANT */

    if (!weechat_aspell_speller_init ())
        return WEECHAT_RC_ERROR;

    if (!weechat_aspell_config_init ())
        return WEECHAT_RC_ERROR;

    weechat_aspell_config_read ();

    weechat_aspell_command_init ();

    weechat_aspell_completion_init ();

    /*
     * callback for spell checking input text
     * we use a low priority here, so that other modifiers "input_text_display"
     * (from other plugins) will be called before this one
     */
    weechat_hook_modifier ("500|input_text_display",
                           &weechat_aspell_modifier_cb, NULL, NULL);

    weechat_aspell_bar_item_init ();

    weechat_aspell_info_init ();

    weechat_hook_signal ("buffer_switch",
                         &weechat_aspell_buffer_switch_cb, NULL, NULL);
    weechat_hook_signal ("window_switch",
                         &weechat_aspell_window_switch_cb, NULL, NULL);
    weechat_hook_signal ("buffer_closed",
                         &weechat_aspell_buffer_closed_cb, NULL, NULL);
    weechat_hook_signal ("debug_libs",
                         &weechat_aspell_debug_libs_cb, NULL, NULL);

    return WEECHAT_RC_OK;
}
Exemple #2
0
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
    /* make C compiler happy */
    (void) argc;
    (void) argv;
    
    weechat_plugin = plugin;
    
    if (!weechat_aspell_config_init ())
        return WEECHAT_RC_ERROR;
    
    if (weechat_aspell_config_read () < 0)
        return WEECHAT_RC_ERROR;
    
    /* command /aspell */
    weechat_hook_command ("aspell",
                          N_("aspell plugin configuration"),
                          N_("dictlist | enable lang | disable | "
                             "addword [lang] word"),
                          N_("dictlist: show installed dictionaries\n"
                             "  enable: enable aspell on current buffer\n"
                             " disable: disable aspell on current buffer\n"
                             " addword: add a word in your personal aspell "
                             "dictionary\n"
                             "\n"
                             "Input line beginning with a '/' is not checked, "
                             "except for some commands."),
                          "dictlist"
                          " || enable %(aspell_langs)"
                          " || disable"
                          " || addword",
                          &weechat_aspell_command_cb, NULL);
    weechat_hook_completion ("aspell_langs",
                             N_("list of supported langs for aspell"),
                             &weechat_aspell_completion_langs_cb, NULL);
    
    /* callback for buffer_switch */
    weechat_hook_signal ("buffer_switch",
                         &weechat_aspell_buffer_switch_cb, NULL);
    
    /* callback for spell checking input text */
    weechat_hook_modifier ("input_text_display",
                           &weechat_aspell_modifier_cb, NULL);
    
    weechat_aspell_create_spellers (weechat_current_buffer ());
    
    return WEECHAT_RC_OK;
}
Exemple #3
0
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
    /* make C compiler happy */
    (void) argc;
    (void) argv;

    weechat_plugin = plugin;

    if (!weechat_aspell_config_init ())
        return WEECHAT_RC_ERROR;

    if (weechat_aspell_config_read () < 0)
        return WEECHAT_RC_ERROR;

    /* command /aspell */
    weechat_hook_command ("aspell",
                          N_("aspell plugin configuration"),
                          N_("enable|disable|toggle"
                             " || listdict"
                             " || setdict <lang>"
                             " || deldict"
                             " || addword [<lang>] <word>"),
                          N_("  enable: enable aspell\n"
                             " disable: disable aspell\n"
                             "  toggle: toggle aspell\n"
                             "listdict: show installed dictionaries\n"
                             " setdict: set dictionary for current buffer\n"
                             " deldict: delete dictionary used on current "
                             "buffer\n"
                             " addword: add a word in personal aspell "
                             "dictionary\n"
                             "\n"
                             "Input line beginning with a '/' is not checked, "
                             "except for some commands (see /set "
                             "aspell.check.commands).\n\n"
                             "To enable aspell on all buffers, use option "
                             "\"default_dict\", then enable aspell, for "
                             "example:\n"
                             "  /set aspell.check.default_dict \"en\"\n"
                             "  /aspell enable\n\n"
                             "Default key to toggle aspell is alt-s."),
                          "enable"
                          " || disable"
                          " || toggle"
                          " || listdict"
                          " || setdict %(aspell_langs)"
                          " || deldict"
                          " || addword",
                          &weechat_aspell_command_cb, NULL);
    weechat_hook_completion ("aspell_langs",
                             N_("list of supported langs for aspell"),
                             &weechat_aspell_completion_langs_cb, NULL);

    /*
     * callback for spell checking input text
     * we use a low priority here, so that other modifiers "input_text_display"
     * (from other plugins) will be called before this one
     */
    weechat_hook_modifier ("500|input_text_display",
                           &weechat_aspell_modifier_cb, NULL);

    return WEECHAT_RC_OK;
}