Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii via Gdb-patches <gdb-patches@sourceware.org>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Allow to document user-defined aliases.
Date: Mon, 25 Jul 2022 14:24:23 +0300	[thread overview]
Message-ID: <831qu9fna0.fsf@gnu.org> (raw)
In-Reply-To: <20220725041113.185127-1-philippe.waroquiers@skynet.be> (message from Philippe Waroquiers via Gdb-patches on Mon, 25 Jul 2022 06:11:13 +0200)

> Date: Mon, 25 Jul 2022 06:11:13 +0200
> From: Philippe Waroquiers via Gdb-patches <gdb-patches@sourceware.org>
> 
> When using 'help ALIASNAME', GDB shows the help of the aliased command.
> This is a good default behaviour.
> 
> However, GDB alias command allows to define aliases with arguments
> possibly changing or tuning significantly the behaviour of
> the aliased command.  In such a case, showing the help of the aliased
> command might not be ideal.

But it doesn't do much harm, either.  Moreover, it is useful to tell
the user that some handy aliases exist related to the command.

> This is particularly true when defining an alias as a set of
> nested 'with' followed by a last command to launch, such as:
>   (gdb) alias pp10 = with print pretty -- with print elements 10 -- print
> Asking 'help pp10' shows the help of the 'with' command, which is
> not particularly useful:
>   (gdb) help pp10
>   with, pp10, w
>     alias pp10 = with print pretty -- with print elements 10 -- print
>   Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.
>   Usage: with SETTING [VALUE] [-- COMMAND]
>   ....

Maybe help for an alias shouldn't show the original commands, but help
for "with" could usefully mention pp10.

Or maybe we should be smarter and show only the help for pp10 when
help for "print" was requested.

> Such an alias can now be documented by the user:
>   (gdb) document pp10
>   >Pretty printing an expressiong, printing 10 elements.
>   >Usage: pp10 [PRINT-COMMAND-OPTIONS] EXP
>   >See 'help print' for more information.
>   >end
>   (gdb) help pp10
>   Pretty printing an expressiong, printing 10 elements.
>   Usage: pp10 [PRINT-COMMAND-OPTIONS] EXP
>   See 'help print' for more information.
>   (gdb)
> 
> When a user-defined alias is documented specifically, help and apropos
> use the provided alias documentation instead of the documentation of
> the aliased command.
> 
> Such a documented alias is also not shown anymore in the help of the
> aliased command, and the alias is not listed anymore in the help
> of the aliased command.

When you say "such a documented alias", do you mean that by just
documenting the alias has this effect?  IMO, this could be too
far-fetched.  How about adding some specific attribute of the command
to that effect, instead of re-purposing the documentation attribute?

> +(@pxref{Command aliases default args,}).
                                       ^
That comma should be deleted.

The documentation parts are OK, assuming that the implementation is
accepted.

Thanks.

  reply	other threads:[~2022-07-25 11:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25  4:11 Philippe Waroquiers via Gdb-patches
2022-07-25 11:24 ` Eli Zaretskii via Gdb-patches [this message]
2022-07-25 20:35   ` Philippe Waroquiers via Gdb-patches
2022-07-26 11:00     ` Eli Zaretskii via Gdb-patches
2022-08-04 19:12 ` Tom Tromey
2022-08-07 19:14   ` Philippe Waroquiers via Gdb-patches
2022-08-04 19:13 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=831qu9fna0.fsf@gnu.org \
    --to=gdb-patches@sourceware.org \
    --cc=eliz@gnu.org \
    --cc=philippe.waroquiers@skynet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox