www.delorie.com/gnu/docs/readline/rlman_30.html   search  
 
Buy GNU books!


GNU Readline Library

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.1 Naming a Function

The user can dynamically change the bindings of keys while using Readline. This is done by representing the function with a descriptive name. The user is able to type the descriptive name when referring to the function. Thus, in an init file, one might find

 
Meta-Rubout:	backward-kill-word

This binds the keystroke Meta-Rubout to the function descriptively named backward-kill-word. You, as the programmer, should bind the functions you write to descriptive names as well. Readline provides a function for doing that:

Function: int rl_add_defun (const char *name, rl_command_func_t *function, int key)
Add name to the list of named functions. Make function be the function that gets called. If key is not -1, then bind it to function using rl_bind_key().

Using this function alone is sufficient for most applications. It is the recommended way to add a few functions to the default functions that Readline has built in. If you need to do something other than adding a function to Readline, you may need to use the underlying functions described below.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003  

Please take a moment to fill out this visitor survey
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)