public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>,
	gdb-patches@sourceware.org
Subject: Re: [RFAv2 1/4] Implement user defined prefix.
Date: Wed, 27 Nov 2019 21:37:00 -0000	[thread overview]
Message-ID: <61633898-2b36-b3dc-36d4-c3488cb1f912@simark.ca> (raw)
In-Reply-To: <20191126233423.14801-2-philippe.waroquiers@skynet.be>

> diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
> index 06cdcd6bfe..e0463cb5b7 100644
> --- a/gdb/cli/cli-script.c
> +++ b/gdb/cli/cli-script.c
> @@ -29,6 +29,7 @@
>  #include "cli/cli-cmds.h"
>  #include "cli/cli-decode.h"
>  #include "cli/cli-script.h"
> +#include "cli/cli-style.h"
>  
>  #include "extension.h"
>  #include "interps.h"
> @@ -1395,7 +1396,15 @@ do_define_command (const char *comname, int from_tty,
>        int q;
>  
>        if (c->theclass == class_user || c->theclass == class_alias)
> -	q = query (_("Redefine command \"%s\"? "), c->name);
> +	{
> +	  /* if C is a prefix command, tell the user its subcommands will
> +	     be kept, and ask if ok to redefine the command.  */
> +	  if (c->prefixlist != nullptr)
> +	    q = query (_("Keeping subcommands of prefix command \"%s\".\n"
> +			 "Redefine command \"%s\"? "), c->name, c->name);
> +	  else
> +	    q = query (_("Redefine command \"%s\"? "), c->name);
> +	}

I think it's nice to mention that the subcommands will be kept.  But if the command
is a prefix command and has never been defined itself, wouldn't you skip the question?
Don't you find it strange to ask "Redefine" for something that was never defined?

Simon

  reply	other threads:[~2019-11-27 21:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 23:34 [RFAv2 0/4] More flexible user-defined commands prefixing and naming Philippe Waroquiers
2019-11-26 23:34 ` [RFAv2 2/4] Test define-prefix Philippe Waroquiers
2019-11-27 21:43   ` Simon Marchi
2019-11-26 23:34 ` [RFAv2 4/4] Document define-prefix command and the use of . in command names Philippe Waroquiers
2019-11-27  5:21   ` Eli Zaretskii
2019-11-26 23:34 ` [RFAv2 1/4] Implement user defined prefix Philippe Waroquiers
2019-11-27 21:37   ` Simon Marchi [this message]
2019-11-26 23:34 ` [RFAv2 3/4] Allow . character as part of command names Philippe Waroquiers
2019-11-27 21:44   ` Simon Marchi

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=61633898-2b36-b3dc-36d4-c3488cb1f912@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).