Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

old-menu-complete behavior in bash v4 / readline v6

0 views
Skip to first unread message

Alan

unread,
Mar 14, 2011, 3:20:19 PM3/14/11
to bug-...@gnu.org
Hi,

I prefer the pre-readline-6.0 version of menu completion, so I tried
using the "old-menu-complete" option in bash v4 / readline v6.

However, "old-menu-complete" doesn't behave exactly like
"menu-complete" did in bash v3 / readline v5.

For example, in bash v3:

$ mkdir directory
$ touch directory/{a,b,c,d,e}
$ less directory/ [invoke "menu-complete" command]
$ less directory/a [invoke "menu-complete" command]
$ less directory/b

In bash v4, using "old-menu-complete":

$ mkdir directory
$ touch directory/{a,b,c,d,e}
$ less directory/ [invoke "old-menu-complete" command]
a b c d e
$ less directory/a

In other words, in bash v3, "menu-complete" basically just cycles
through the possible matches, WITHOUT displaying all the possible
matches before the first cycle. However, in bash v4,
"old-menu-complete" displays ALL possible matches before cycling
through the matches on the command line.

Is there a way I can get "old-menu-complete" in bash v4 to match the
behavior of "menu-complete" in bash v3 exactly in this regard?


Thanks for your help,
Alan

Chet Ramey

unread,
Mar 15, 2011, 9:32:58 AM3/15/11
to Alan, bug-...@gnu.org, chet....@case.edu

Turn off `show-all-if-ambiguous'. It was a bug in pre-readline6
versions that menu completion did not honor the setting of that
variable.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU ch...@case.edu http://cnswww.cns.cwru.edu/~chet/

Alan

unread,
Mar 15, 2011, 11:13:47 AM3/15/11
to chet....@case.edu, bug-...@gnu.org
Thanks for the response!

The problem is, if I turn off 'show-all-if-ambiguous', hitting tab
won't display all the possible completions. I like the old behavior of
'menu-complete' because if I wanted to display the completions, I
could always hit tab before purely cycling through the choices with
'menu-complete.' So it gives more flexibility in my opinion.

Plus, I expected something with the name, 'old-menu-complete,' to
behave like the old 'menu-complete' did, but I digress...

What would be the best way for me to make old-menu-complete behave
like menu-complete did pre-readline-6.0? (In other words, behave like
'show-all-if-ambiguous' is off, while it is really on for other stuff
like tab.) Would it be best to write some sort of bash function? Or
would it be better to just modify the source code?


Thanks so much for your help,
Alan

Chet Ramey

unread,
Mar 15, 2011, 11:24:36 AM3/15/11
to Alan, bug-...@gnu.org, chet....@case.edu
On 3/15/11 11:13 AM, Alan wrote:
> Thanks for the response!
>
> The problem is, if I turn off 'show-all-if-ambiguous', hitting tab
> won't display all the possible completions. I like the old behavior of
> 'menu-complete' because if I wanted to display the completions, I
> could always hit tab before purely cycling through the choices with
> 'menu-complete.' So it gives more flexibility in my opinion.
>
> Plus, I expected something with the name, 'old-menu-complete,' to
> behave like the old 'menu-complete' did, but I digress...

Sure, modulo any bug fixes. It was, as I said, a bug that the menu
completion function didn't behave like other completion functions and
honor the setting of show-all-if-ambiguous. That was changed in the
readline-6.2 development cycle before I changed the behavior more
radically and split the old from the new.

> What would be the best way for me to make old-menu-complete behave
> like menu-complete did pre-readline-6.0? (In other words, behave like
> 'show-all-if-ambiguous' is off, while it is really on for other stuff
> like tab.) Would it be best to write some sort of bash function? Or
> would it be better to just modify the source code?

You'll have to modify the source code.

Alan

unread,
May 25, 2012, 4:24:42 PM5/25/12
to bug-...@gnu.org
By the way, if anyone wants a fix for this bug, here it is:

In lib/readline/funmap.c, around line 107, make "menu-complete" map to
rl_old_menu_complete:

{ "menu-complete", rl_old_menu_complete },

In lib/readline/complete.c, around line 2443, comment out the if-loop:

/*if (match_list_size > 1 && _rl_complete_show_all)
display_matches (matches);*/

Then compile and install. Works great now.
0 new messages