Re: [PATCH] partial fix PR 14777: Add abbrev cmd 'fo' for 'forward-search'.

Joel Brobecker
2012-11-07T15:13:58Z

> We can fix this problem in two ways, either remove this line above
> from the doc or define "fo" as the abbreviated command of
> 'forward-search'. IMO, latter is better, so this is what this patch
> does.

I tend to agree.

> gdb/doc:
> 2012-11-07 Yao Qi <yao@codesourcery.com>
>
> * gdb.texinfo (Search): Add kindex for 'fo'.

Needs approval from Eli.

> gdb:
> 2012-11-07 Yao Qi <yao@codesourcery.com>
>
> PR gdb/14777.
> * source.c (_initialize_source): Call add_com_alias to abbreviate
> 'forward-search' as 'fo'.

OK.

I should also add that we should make sure that we do not approve
updates to the manual that document command abbreviations without
specifically defining the abbreviation in our code. As demonstrated
in this case, implicit abbreviations may become ambiguous over time.

> ---
> gdb/doc/gdb.texinfo | 1 +
> gdb/source.c | 1 +
> 2 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index c2c7745..c7777e6 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -6955,6 +6955,7 @@ regular expression.
> @table @code
> @kindex search
> @kindex forward-search
> +@kindex fo @r{(@code{forward-search})}
> @item forward-search @var{regexp}
> @itemx search @var{regexp}
> The command @samp{forward-search @var{regexp}} checks each line,
> diff --git a/gdb/source.c b/gdb/source.c
> index bd11c63..307fecc 100644
> --- a/gdb/source.c
> +++ b/gdb/source.c
> @@ -1953,6 +1953,7 @@ The address is also stored as the value of \"$_\"."));
> Search for regular expression (see regex(3)) from last line listed.\n\
> The matching line number is also stored as the value of \"$_\"."));
> add_com_alias ("search", "forward-search", class_files, 0);
> + add_com_alias ("fo", "forward-search", class_files, 1);
>
> add_com ("reverse-search", class_files, reverse_search_command, _("\
> Search backward for regular expression (see regex(3)) from last line listed.\n\
> --
> 1.7.7.6

--
Joel