Is there any way to execute user code each time menu-complete displays the next completion?
E.g. in the script below, if I hit tab repeatedly, it cycles through displaying "a" and "b". I would like some of my python code to execute when it displays "a", and when it displays "b".
import rl
def complete(text):
return ['a', 'b']
rl.completer.parse_and_bind('tab: menu-complete')
rl.completer.completer = rl.generator(complete)
raw_input()
In the readline C code I see, e.g. a call to display_matches (which itself calls rl_completion_display_matches_hook) in rl_menu_complete, but I am not entirely sure whether what I want is possible and wanted to check.
Thanks!
Is there any way to execute user code each time
menu-completedisplays the next completion?E.g. in the script below, if I hit
tabrepeatedly, it cycles through displaying "a" and "b". I would like some of my python code to execute when it displays "a", and when it displays "b".In the readline C code I see, e.g. a call to
display_matches(which itself callsrl_completion_display_matches_hook) inrl_menu_complete, but I am not entirely sure whether what I want is possible and wanted to check.Thanks!