i9e: print warning if keyseq can not be mapped.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 8 Mar 2016 23:23:17 +0000 (00:23 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 1 Apr 2016 23:40:15 +0000 (01:40 +0200)
In i9e_open() we currently ignore errors from rl_generic_bind(), which
is OK, but we should at least let the user know that the binding
won't work. While at it, call rl_bind_keyseq_in_map() instead of
rl_generic_bind() as the former function provides all we need and
is simpler.

Also fix the typo in the comment.

interactive.c

index b5ee797..9f8a501 100644 (file)
@@ -468,10 +468,12 @@ int i9e_open(struct i9e_client_info *ici, struct sched *s)
        if (ici->bound_keyseqs) {
                char *seq;
                int i;
-               /* bind each key sequence to the our dispatcher */
-               for (i = 0; (seq = ici->bound_keyseqs[i]); i++)
-                       rl_generic_bind(ISFUNC, seq, (char *)dispatch_key,
-                               i9ep->bare_km);
+               /* bind each key sequence to our dispatcher */
+               for (i = 0; (seq = ici->bound_keyseqs[i]); i++) {
+                       if (rl_bind_keyseq_in_map(seq,
+                                       dispatch_key, i9ep->bare_km) != 0)
+                               PARA_WARNING_LOG("could not bind #%d: %s\n", i, seq);
+               }
                i9ep->num_key_bindings = i;
        }
        if (ici->history_file)