nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH] bindings: make the linter separately accessible, th


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH] bindings: make the linter separately accessible, through M-B by default
Date: Sun, 23 Sep 2018 16:27:03 +0200

This allows running the speller (default binding: ^T) also on files for
which a linter has been defined.

This fulfills https://savannah.gnu.org/bugs/?54711.
Requested-by: Mike Frysinger <address@hidden>
---
 src/global.c | 26 ++------------------------
 src/proto.h  |  4 ----
 src/winio.c  |  7 -------
 3 files changed, 2 insertions(+), 35 deletions(-)

diff --git a/src/global.c b/src/global.c
index 6cbf700f..72a3de51 100644
--- a/src/global.c
+++ b/src/global.c
@@ -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;
diff --git a/src/proto.h b/src/proto.h
index 71ef8eab..4c16b2ca 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -323,10 +323,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
diff --git a/src/winio.c b/src/winio.c
index 9de1247d..700b412c 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3335,13 +3335,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);
 }
 
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]