bindings: make the linter separately accessible, through M-B by default

This allows running the speller (default binding: ^T) also on files for
which a linter has been defined.  This makes it possible to spell check
comment blocks in source files, for example.

This fulfills https://savannah.gnu.org/bugs/?54711.
Requested-by: Mike Frysinger <vapier@gentoo.org>
master
Benno Schulenberg 2018-09-23 16:15:55 +02:00
parent 600295a3af
commit 628eef28b3
3 changed files with 2 additions and 35 deletions

View File

@ -1114,11 +1114,9 @@ void shortcut_init(void)
#ifdef ENABLE_SPELLER
add_to_sclist(MMAIN, "^T", 0, do_spell, 0);
add_to_sclist(MMAIN, "F12", 0, do_spell, 0);
#else
#ifdef ENABLE_COLOR
add_to_sclist(MMAIN, "^T", 0, do_linter, 0);
add_to_sclist(MMAIN, "F12", 0, do_linter, 0);
#endif
#ifdef ENABLE_COLOR
add_to_sclist(MMAIN, "M-B", 0, do_linter, 0);
#endif
add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0);
add_to_sclist(MMAIN, "F11", 0, do_cursorpos_void, 0);
@ -1358,26 +1356,6 @@ void shortcut_init(void)
#endif
}
#if defined(ENABLE_COLOR) && defined(ENABLE_SPELLER)
/* Assign one function's shortcuts to another function. */
void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
{
for (sc *s = sclist; s != NULL; s = s->next)
if (s->func == oldfunc)
s->func = newfunc;
}
void set_linter_shortcut(void)
{
replace_scs_for(do_spell, do_linter);
}
void set_speller_shortcut(void)
{
replace_scs_for(do_linter, do_spell);
}
#endif /* ENABLE_COLOR && ENABLE_SPELLER */
const subnfunc *sctofunc(const sc *s)
{
subnfunc *f = allfuncs;

View File

@ -322,10 +322,6 @@ int keycode_from_string(const char *keystring);
void assign_keyinfo(sc *s, const char *keystring, const int keycode);
void print_sclist(void);
void shortcut_init(void);
#ifdef ENABLE_COLOR
void set_linter_shortcut(void);
void set_speller_shortcut(void);
#endif
const subnfunc *sctofunc(const sc *s);
const char *flagtostr(int flag);
#ifdef ENABLE_NANORC

View File

@ -3338,13 +3338,6 @@ void total_refresh(void)
* portion of the window. */
void display_main_list(void)
{
#if defined(ENABLE_COLOR) && defined(ENABLE_SPELLER)
if (openfile->syntax && openfile->syntax->linter)
set_linter_shortcut();
else
set_speller_shortcut();
#endif
bottombars(MMAIN);
}