Message52325
Hi Ben, I'm sorry if you thought my short reply suggested I hadn't looked at the patch properly. I'll try to clarify what I meant.
Gnu readline provides an interface to custom functions: you declare a function that takes a 'count' and a 'key' and returns 0 or an error. You then call rl_add_defunc to declare it. You use the name you used in 'rl_add_defunc' in the readline init file to bind the command to a key.
The patch uses a different interface: the user provides a function that takes no arguments. He declares it by calling 'set_custom_hook', and calls it by using the name 'custom' in the init file to bind it to a key.
An interface consistent between python and readline would be:
def say_hello(key, count):
...
readline.add_defunc("say_hello", say_hello)
readline.parse_and_bind('"?" : say_hello')
(Perhaps the 'add_defun' is an artefact of lack of dynamic features of C and would be dropped from the python interface).
The patch's use of a 'custom' hook is more complicated than using the function name directly in the init file, and provides less functionality (a single command, and removes the arguments that the c command would have). Accepting this patch will cause minor compatibility trouble in future if anyone works out a way round the admittedly difficult technical problems of doing things the 'right' way.
Given the interface troubles, I'm not convinced enough of the usefulness of the patch.
|
|
Date |
User |
Action |
Args |
2007-08-23 15:57:47 | admin | link | issue1690201 messages |
2007-08-23 15:57:47 | admin | create | |
|