bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rl_startup_hook is called before readline prints every prompt


From: 林宏雄
Subject: Re: rl_startup_hook is called before readline prints every prompt
Date: Sat, 16 Dec 2023 00:25:33 +0900

Thank you for your reply.

> rl_startup_hook is called before readline prints every prompt.

Now I noticed that the GNU Readline manual carefully uses "Readline" and "readline" (@code{readline}) in different meanings, the GNU Readline Library and readline() function respectively.

> 2.4.3 Binding Keys
...
> Since readline() installs a set of default key bindings the first time it is called, there is always the danger
> that a custom binding installed before the first call to readline() will be overridden.
> An alternate mechanism is to install custom key bindings in an initialization function assigned to the rl_startup_hook variable (see Readline Variables).

After reading this description for the case which readline() is called first, I read the the following:

>> Variable: rl_hook_func_t * rl_startup_hook
>> If non-zero, this is the address of a function to call just before readline prints the first prompt.

I didn't even know that the readline() function may print prompt more than once.

The only thing I can think of to improve it is to add the following statement to section 2.4.3:

   Notice that startup_hook is called each time the readline function is called.

This may just be redundant, as a user will know if he/she uses it, as I did.

Regards, 
--
Hiroo Hayashi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]