Your comments

Additional nugget: how can I bind toggling draw_white_space to a shortcut? Using some examples, I tried adding the following line to my keymap, but it doesn't toggle, it just toggles once, but re-pressing the shortcut doesn't produce anything:

Maybe I should specify to the toggle_setting commang the values to toggle between? But how can I do that? Also, how did you find the existence of the draw_white_space command? And how can I find the values accepted by the command?