This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author btimby
Recipients
Date 2007-07-18.05:42:42
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Jim, here is what I don't understand (item 3).

Currently, my patch (which is now an extension: http://ben.timby.com/pub/bt.tar.gz) works like so:

1. Module is initialized. rl_add_defun is called to register on_custom_hook as a handler for named function "custom".
2. User calls set_custom_hook. This simply sets custom_hook and custom_hook_tstate to proper values.
3. User calls readline.parse_and_bind to bind a key to the named function "custom".
4. When the bound key is pressed, readline invokes on_custom_hook, which in turn invokes the function provided by the user as a parameter to set_custom_hook (if it was valid).

This is simple, because there is only one custom function and one handler for it. In order to provide functionality for multiple handlers, you would as you described require a list. However, what would on_custom_hook look like? It receives only (int count, int key) how can it use these to look up the proper python function to invoke? Basically, how can it differentiate between the various registered handlers? Here is an example.

1. Module is initialized.
2. User calls set_custom_hook, and provides a function name and handler.
3. The function name and handler are stored in a list.
4. rl_add_defun is used to register ?? as a handler for the named function.
5. User calls readline.parse_and_bind to bind a key to their named function.
6. ?? does ?? when invoked to find the python handler for the named function.

Does that make any sense?
History
Date User Action Args
2007-08-23 15:57:49adminlinkissue1690201 messages
2007-08-23 15:57:49admincreate