On Sat, Apr 9, 2016 at 11:40 AM, FERREC Romain <rom...@elgeekador.net> wrote: > Le 09/04/2016 15:44, Robby Findler a écrit : >> >> You could write a little loop to keep the functions in the keymap and >> remove all the keybindings and then add back in the bindings you >> wanted. That way you could avoid duplicating code? > > > Ah yes it is possible, I have not seen some functions in the documentation.. > but honestly this can be improved, i'll try to work on it when I'll have > some times. > > For now I have made this little function : > > (define (generate-keymap funcsList) > (define keymap (keymap:get-global)) > (send keymap add-function "void" void) > (for ([(key value) (in-hash (send keymap get-map-function-table))]) > (unless (list? (member value funcsList)) > (send keymap map-function (symbol->string key) "void"))) > keymap) > > It returns a keymap. "funcsList" contains list of function names from > keymap:get-global, and keep the keybindings. Of course, it would have been > better if we could remove the keybinding+function directly from the keymap.
Well, removing them could affect other code that uses them, so making a copy is best. Robby -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.